Skip to content

Conversation

@alex-spies
Copy link
Contributor

@alex-spies alex-spies commented Aug 5, 2025

Fix #131509
Fix #132634

Make Attribute#equals and Alias#equals respect the NameIds, so that plan transformations that happen to replace an attribute/alias by one that only differs by id, we still actually update the plan rather than keeping the old plan object.

This requires a bunch of boilerplate-y test updates. I'll point to the non-boilerplate changes in comments below.

Copy link
Contributor Author

@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.

We probably also want to update the hashCode implementations, although this will mostly lead to a reduction of collisions.

@alex-spies alex-spies force-pushed the make-attribute-equality-stricter branch from fffe752 to a707bec Compare September 15, 2025 11:46
alex-spies and others added 26 commits September 15, 2025 14:05
Just re-use the name ids, that prevents having to address that they may
be mapped differently in the deserialized plan.
Don't even walk the plan to collect name ids, that's silly.
UnresolvedAttribute's ids specifically shouldn't matter here.
@alex-spies alex-spies added >bug auto-backport Automatically create backport pull requests when merged :Analytics/ES|QL AKA ESQL v9.2.1 labels Oct 20, 2025
@alex-spies alex-spies marked this pull request as ready for review October 20, 2025 13:30
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Oct 20, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @alex-spies, I've created a changelog YAML for you.

Copy link
Contributor

@luigidellaquila luigidellaquila left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM. Awesome!

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

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

👏

@alex-spies alex-spies added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Oct 22, 2025
@elasticsearchmachine elasticsearchmachine merged commit f7d4422 into elastic:main Oct 22, 2025
34 checks passed
@alex-spies alex-spies deleted the make-attribute-equality-stricter branch October 22, 2025 11:16
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.2 Commit could not be cherrypicked due to conflicts

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

@alex-spies
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.2

Questions ?

Please refer to the Backport tool documentation

alex-spies added a commit to alex-spies/elasticsearch that referenced this pull request Oct 22, 2025
Fix elastic#131509 Fix
elastic#132634

Make `Attribute#equals` and `Alias#equals` respect the `NameId`s, so
that plan transformations that happen to replace an attribute/alias by
one that only differs by id, we still actually update the plan rather
than keeping the old plan object.

This requires a bunch of boilerplate-y test updates. I'll point to the
non-boilerplate changes in comments below.

(cherry picked from commit f7d4422)

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java
elasticsearchmachine pushed a commit that referenced this pull request Oct 22, 2025
… (#136950)

* ESQL: Make equals include ids for Alias, TypedAttribute (#132455)

Fix #131509 Fix
#132634

Make `Attribute#equals` and `Alias#equals` respect the `NameId`s, so
that plan transformations that happen to replace an attribute/alias by
one that only differs by id, we still actually update the plan rather
than keeping the old plan object.

This requires a bunch of boilerplate-y test updates. I'll point to the
non-boilerplate changes in comments below.

(cherry picked from commit f7d4422)

# Conflicts:
#	x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

* Fix id ignoring matcher for UsingJoinType
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 auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport pending >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.2.1 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESQL: double LOOKUP JOIN/ENRICH on the same policy + STATS VALUES returns wrong values ES|QL: IllegalStateException with RENAME x AS y, y AS x

7 participants