ESQL: Skip nullifying aliases for Aggregate groups#141340
Merged
alex-spies merged 41 commits intoelastic:mainfrom Mar 10, 2026
Merged
ESQL: Skip nullifying aliases for Aggregate groups#141340alex-spies merged 41 commits intoelastic:mainfrom
alex-spies merged 41 commits intoelastic:mainfrom
Conversation
This fixes the generation of name IDs for the attributes corresponding to the unmapped fields and are pushed to different branches in UntionAll. So far, one set of IDs was generated and reused for all subplans. This is now updated to own set per subplan. A minor collateral proposed change: the CSV spec-based tests skipped due to missing capabilities are now logged.
This re-introduces skipping the `UnresolvedAttribute`s that are collected from the `Aggregate#aggregates` and are `Alias`es in the `#groupings`. In this case, the aliases, not their child, result in an `UnresolvedAttribute`. This must not be nullified, since they'll be subsequently resolved part of `Alias`'es child resolution. The side effect of doing otherwise is that they can shadow attributes produced by the source or `Eval`'d. Related, in Aggregate resoluion skip resolving the aggregates based on those input attributes that share a name with the not-yet-resolved `UnresolvedAttribute`s. This was incorrect, but didn't occur before unmapped-fields fieature since the resolution of the `Aggregate` all happened in one Analyzer cycle (unlike with unmapped-fields).
Collaborator
|
Hi @bpintea, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
63 tasks
Extracted from elastic#142863 Co-authored-by: Ievgen Degtiarenko <ievgen.degtiarenko@elastic.co>
Contributor
|
Ok, all comments addressed. I'll merge + backport this now. |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
This was referenced Mar 10, 2026
Contributor
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
alex-spies
pushed a commit
to alex-spies/elasticsearch
that referenced
this pull request
Mar 12, 2026
* Fix injected attributes's IDs on UnionAll branches * Skip nullifying of aliases for Aggregate groups * Fix LookupJoin getting Evals inserted on the right-hand side * Log skipped spec tests if capabilities were missing * Add minimal TS spec tests for nullify * Add reproducer test for join issue * Add spec test: STATS BY missing with FROM --------- Co-authored-by: Alexander Spies <alexander.spies@elastic.co> Co-authored-by: Ievgen Degtiarenko <ievgen.degtiarenko@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit f7b87e3) # Conflicts: # muted-tests.yml # x-pack/plugin/esql/qa/testFixtures/src/main/resources/unmapped-nullify.csv-spec # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Analyzer.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/rules/ResolveUnmapped.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerUnmappedTests.java
elasticsearchmachine
pushed a commit
that referenced
this pull request
Mar 13, 2026
…144097) * ESQL: Skip nullifying aliases for Aggregate groups (#141340) * Fix injected attributes's IDs on UnionAll branches * Skip nullifying of aliases for Aggregate groups * Fix LookupJoin getting Evals inserted on the right-hand side * Log skipped spec tests if capabilities were missing * Add minimal TS spec tests for nullify * Add reproducer test for join issue * Add spec test: STATS BY missing with FROM --------- Co-authored-by: Alexander Spies <alexander.spies@elastic.co> Co-authored-by: Ievgen Degtiarenko <ievgen.degtiarenko@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> (cherry picked from commit f7b87e3) # Conflicts: # muted-tests.yml # x-pack/plugin/esql/qa/testFixtures/src/main/resources/unmapped-nullify.csv-spec # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Analyzer.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/rules/ResolveUnmapped.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerUnmappedTests.java * [CI] Auto commit changes from spotless * Remove accidentally committed spec tests * Fix some more conflict mis-resolutions * Add transformDownSkipBranch * Make tests run the same in multi cluster suite * Remove redundant test tsImplicitTimestampSortBasicWithMissing cannot run on 9.3 because it requires the ts_implicit_timestamp_sort capability. --------- Co-authored-by: Bogdan Pintea <bogdan.pintea@elastic.co> Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This re-introduces skipping the
UnresolvedAttributes that arecollected from the
Aggregate#aggregatesand areAliases in the#groupings. In this case, the aliases, not their child, result in anUnresolvedAttribute. This must not be nullified, since they'll besubsequently resolved part of
Alias'es child resolution.The side effect of doing otherwise is that they can shadow attributes
produced by the source or
Eval'd.Related, in Aggregate resoluion skip resolving the aggregates based on
those input attributes that share a name with the not-yet-resolved
UnresolvedAttributes. This was incorrect, but didn't occur beforeunmapped-fields fieature since the resolution of the
Aggregateallhappened in one Analyzer cycle (unlike with unmapped-fields).
Another fix concerns skipping the right-hand side of Joins when
introducing null-aliases.
Also, null-aliases are no longer introduced behind
Aggregatesif these shadow an existing source. (This is a moot change, since in
this case the plan verification would fail anyways. But it is the correct
way.)