-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Support for multi-argument aggs #132424
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
Conversation
Adds support for multi-argument grouped aggs. Previously we only had support for aggs with a value and a timestamp. Now we can support any number of fields. This change is mostly mechanical and mostly in generated code. The only production code changes are: 1. Rename things like `block` and `vector` to `fooBlock` so names are unique with multi-argument fields. `foo` comes from the name of the argument to `combine`. 2. Support for passing `Block`s of `long`s in `FirstOverTime` and `LastOverTime`. This will allow it to function outside of TSDB. 3. Flip the order of the arguments in the `combine` methods for `FirstOverTime` and `LastOverTime` so they line up with how the ESQL code orders the arguments. This shouldn't change the runtime at all. 4. Rename the offset variable we use for reading from vectors in non-grouped code so it's the same name as we use in grouped code. This just keeps the code gen a little more consistent.
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
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!
Reviewing implementers feels like reviewing regex though, it would be nice to have a draft with a real use case (Maybe for future PRs)
| private TypeSpec addInput(Consumer<MethodSpec.Builder> addBlock) { | ||
| TypeSpec.Builder builder = TypeSpec.anonymousClassBuilder(""); | ||
| builder.addSuperinterface(GROUPING_AGGREGATOR_FUNCTION_ADD_INPUT); | ||
| private TypeSpec addInput(boolean valuesAreVector) { |
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: valuesIsVector, as we're talking about a single block?
Same for other cases
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.
It's all of the inputs - usually one, but for FIRST/LAST it'll be two.
Yeah, I get that. The ValuesOverTime ones show the big changes. What would help more? Pointing them out? Copying bits into the commit message? |
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. Thanks Nik!
|
Thanks folks! I will have to think about a test that "attacks" nested loops before we start using this much. |
…cking * upstream/main: (24 commits) Revert "[Fleet] add privileges to `kibana_system` to read integrations data (elastic#132400)" (elastic#132499) ESQL: Rename evaluators for FIRST and LAST (elastic#132466) Add inference fields to semantic text docs (elastic#132471) ESQL: Allow FIRST and LAST as method name (elastic#132469) ESQL: Add javadoc for PushDownAndCombineFilters (elastic#132484) Misc cleanups in Coordinator (elastic#132452) [DiskBBQ] Write the maximum posting list size to avoid resizing the docId array (elastic#132447) Improve exception handling for JsonXContentParser (elastic#123439) Clarify quantization on semantic_text BBQ dense vector default (elastic#132470) Fix test infra NPE in doEnsureClusterStateConsistency (elastic#131859) Stabilize CancellableTasksIT#testRemoveBanParentsOnDisconnect (elastic#131858) Move ClusterApplierService assertion after logging exception (elastic#132446) ESQL: Support for multi-argument aggs (elastic#132424) Update wolfi (versioned) (elastic#132457) ESQL: Fix Function javadoc (elastic#132399) [ML] Inference API disable partial search results (elastic#132362) Unmute testTermsQuery tests (elastic#132409) Fix index lookup when field-caps returns empty mapping (elastic#132138) CompressorFactory.compressor (elastic#132448) ESQL add formatting to plans in javadoc (elastic#132421) ...
Adds support for multi-argument grouped aggs. Previously we only had support for aggs with a value and a timestamp. Now we can support any number of fields.
This change is mostly mechanical and mostly in generated code. The only production code changes are:
blockandvectortofooBlockso names are unique with multi-argument fields.foocomes from the name of the argument tocombine.Blocks oflongs inFirstOverTimeandLastOverTime. This will allow it to function outside of TSDB.combinemethods forFirstOverTimeandLastOverTimeso they line up with how the ESQL code orders the arguments. This shouldn't change the runtime at all.Relates to #108385