-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pkg/telemetryquerylanguage] Support Inequalities in TQL #13320
[pkg/telemetryquerylanguage] Support Inequalities in TQL #13320
Conversation
d6095ee
to
bd39795
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This is failing the impi test because upstream's main branch is currently broken. Once that's fixed I'll rebase, but meanwhile I believe this is ready for review. |
@TylerHelmuth ^, please |
@kentquirk i will start a review. Also, the collector has dropped support for 1.17, so you should be able to use generics from 1.18 now if you want. |
@kentquirk the TQL only supports int64 and float64 for numerics, you may be able to reduce some cases in compare.go for types the query language can't interpret natively. Technically Paths could return types like int or float32, but these are incorrect implementations of a Path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not remove stuff like int32 yet since it's a sunk cost, but I'm willing to. It will reduce both code and test cases if you think we should never need to worry about it.
I think we should probably stick with @bogdandrutu's normal approach of not adding something until we need it. Since the TQL explicitly states it only supports int64 and float64, I think we should drop the other int and float types until the language supports it. Sorry for the extra work!
@TylerHelmuth OK, parser now generates a CompareOp instead of strings, and I've removed support for pointers and non-64-bit type variants (and associated tests). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@bogdandrutu I'd appreciate your review. This is passing all tests and has been reviewed and approved by @TylerHelmuth. |
@kovrus, would you like to review this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, I really like the code comments. I noticed two minor things in the documentation.
@kovrus @evan-bradley please take another look. |
Adds inequality support to TQL.
Previously, TQL supported only
==
and!=
, and only between identical types. With this PR, TQL now also supports<
,<=
,>=
,>
, and can compare across different numeric types (two objects of the same type are compared as that type, but objects of differing types are promoted to the most general type -- int/float is compared as float, while int32/int64 is compared as int64.Link to tracking Issue:
Closes #12491.
Testing:
The testing is fairly extensive:
Documentation:
Benchmark results (the last line is equivalent to the original function):