-
Notifications
You must be signed in to change notification settings - Fork 634
MQE Absent function #10523
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
MQE Absent function #10523
Conversation
d7818b2
to
51762d5
Compare
66776aa
to
607c848
Compare
@charleskorn I have addressed all of your comments from the previous review. Please help to do another review. 🙏 |
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.
Sorry if this has already been discussed/considered (if so, please disregard this comment).
However, I wonder if given the uniqueness of this operator if it makes sense to handle it as a special case instead of as an InstantVectorFunctionOperatorFactory
?
Eg in convertFunctionCallToInstantVectorOperator
in query.go
we check if it's the absent
function and then create the operator and pass it the full inner expression instead of looking it up in instantVectorFunctionOperatorFactories
.
This way the absent
operator can reason about the inner series. For example, if I'm understand the function correctly, there is nothing to do if the inner expression is something other than a selector (eg there's no point evaluating a sum
).
Sorry if this has already been discussed or derails things too much!
|
Right, I see. However it may still be neater to have the operator called specifically in query.go to avoid passing both an evaluated and non-evaluated expression to all the functions (which feels odd). |
Are you referring to passing the expression to the function factory? If so, I don't mind this so much, but I don't hold this opinion strongly. Making |
Yes, that's what I was referring to. |
c9de184
to
c5a1d77
Compare
@jhesketh I will consider to refactor this once I am making progress with But you have some valid points. |
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.
Could you please add a benchmark for this and post a comparison with Prometheus' engine? Assuming the results look OK, I'm happy for this to be merged, but if there's any significant regression with MQE, then let's discuss before merging.
(let me know if you need some help with this)
output := types.InstantVectorSeriesData{} | ||
defer func() { a.called = true }() | ||
|
||
if a.called { | ||
return output, types.EOS | ||
} |
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.
[nit] I think this can be simplified a bit:
output := types.InstantVectorSeriesData{} | |
defer func() { a.called = true }() | |
if a.called { | |
return output, types.EOS | |
} | |
if a.called { | |
return output, types.EOS | |
} | |
a.called = true | |
output := types.InstantVectorSeriesData{} |
Also, I think a name like exhausted
or used
might be clearer - called
is a little ambiguous (what was called?)
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.
Renamed to exhausted and refactor as suggested by removing defer. Except that output initiliasation still need on the top of the line before the first return.
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.
(meant to approve with the comment above 🤦)
Sure I will do the benchmarking shortly. Thanks for checking. |
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
3a3f44a
to
c1536e7
Compare
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
Signed-off-by: Jon Kartago Lamida <me@lamida.net>
What this PR does
Implement absent function. Added a new Operator:
Absent
. We also need to modifyInstantVectorFunctionOperatorFactory
to passparser.Expressions
object needed to evaluate the labels of the absent argument.Benchmark
Step to create the benchmark:
pkg/streamingpromql/benchmarks/benchmarks.go
cd tools/benchmark-query-engine
go run . -bench=Query/absent -count=6 | tee absent-benchmark.txt
./compare.sh absent-benchmark.txt
rm absent-benchmark.txt
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.