Skip to content
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

[ES|QL] Make numberOfChannels consistent with layout map by removing duplicated ChannelSet #125636

Merged
merged 5 commits into from
Mar 26, 2025

Conversation

fang-xing-esql
Copy link
Member

Resolves: #121754

This is another option to solve this bug, if duplicated ChannelSet are expected to be added to the layout or it is not avoidable.

This NullPointerException happens in Layout.Builder.build(), when there is null ChannelSet in Layout.Builder.channels.

A null ChannelSet could be added in Layout.Builder.channels by Layout.inverse(), if the numberOfChannels > the # of items in the layout map. `

When there are multiple batches of data node executions with lookup join and sort in the query, LocalExecutionPlanner.planEval could potentially append duplicated ChannelSet - duplicated NameId and data type, to the list of ChannelSet in Layout.Builder, which causes numberOfChannels > the # of items in the layout map when build() is called and a DefaultLayout is created.

@elasticsearchmachine
Copy link
Collaborator

Hi @fang-xing-esql, I've created a changelog YAML for you.

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@costin
Copy link
Member

costin commented Mar 26, 2025

Look more self contained than #125636

@fang-xing-esql fang-xing-esql marked this pull request as ready for review March 26, 2025 12:01
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Mar 26, 2025
Copy link
Contributor

@alex-spies alex-spies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge this, but should immediately work on a long-term fix.

Attribute ids should not have duplicates in layouts to begin with. The layout should reflect what pages passed through the corresponding operators actually look like - discarding a duplicate attribute means we act as if the block was just not there and this can lead to wrong blocks being passed to operators.

/**
* Create null alias with new id in ReplaceMissingFieldWithNull when there is lookup join with multiple batches.
*/
REPLACE_MISSING_FIELD_WITH_NULL_NEW_ALIAS_ID_FOR_JOIN_AND_MULTIPLE_BATCHES;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the name should reflect the current fix more clearly.

@alex-spies
Copy link
Contributor

When we merge this, let's make sure this gets backported as generously as #125462 was planned to.

@fang-xing-esql fang-xing-esql added the auto-backport Automatically create backport pull requests when merged label Mar 26, 2025
@fang-xing-esql fang-xing-esql merged commit 80125a4 into elastic:main Mar 26, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.0 Commit could not be cherrypicked due to conflicts
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 125636

fang-xing-esql added a commit to fang-xing-esql/Elasticsearch that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (elastic#125636)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (#125636) (#125715)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
@fang-xing-esql
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x
9.0
8.18

Questions ?

Please refer to the Backport tool documentation

fang-xing-esql added a commit to fang-xing-esql/Elasticsearch that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (elastic#125636)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (#125636) (#125720)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
elasticsearchmachine pushed a commit that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (#125636) (#125721)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
mark-vieira pushed a commit to mark-vieira/elasticsearch that referenced this pull request Mar 26, 2025
…duplicated ChannelSet (elastic#125636) (elastic#125720)

* make numberOfChannels consistent with layout

(cherry picked from commit 80125a4)

# Conflicts:
#	x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/RestEsqlTestCase.java
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
omricohenn pushed a commit to omricohenn/elasticsearch that referenced this pull request Mar 28, 2025
…duplicated ChannelSet (elastic#125636)

* make numberOfChannels consistent with layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0 v8.18.1 v8.19.0 v9.0.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ES|QL: NullPointerException planning EVAL
4 participants