Skip to content

ESQL: make AttributeMap and AttributeSet immutable #125938

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

Merged
merged 5 commits into from
Apr 2, 2025

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Mar 31, 2025

This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related #124395

bpintea added 2 commits March 31, 2025 14:11
This will allow reusing them in the plan analysis and skip recreating
them in UnaryPlan/UnaryExec.
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Mar 31, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @bpintea, 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 - thanks for looking into this!

@@ -249,7 +260,7 @@ public boolean isEmpty() {

@Override
public boolean containsKey(Object key) {
return key instanceof NamedExpression ne ? delegate.containsKey(new AttributeWrapper(ne.toAttribute())) : false;
return key instanceof NamedExpression ne && delegate.containsKey(new AttributeWrapper(ne.toAttribute()));
Copy link
Member

Choose a reason for hiding this comment

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

👍

@costin
Copy link
Member

costin commented Apr 2, 2025

To keep the semantics in place, I would look into backporting this to 8.18, 8.19 and 9.0 as well - it will make maintenance a lot easier.

@bpintea bpintea added >refactoring auto-backport Automatically create backport pull requests when merged v8.19.0 v9.0.1 and removed >enhancement labels Apr 2, 2025
@bpintea bpintea merged commit 2b512bc into elastic:main Apr 2, 2025
17 checks passed
@bpintea bpintea deleted the enh/attribute_map_set_immutable branch April 2, 2025 21:27
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

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

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

bpintea added a commit to bpintea/elasticsearch that referenced this pull request Apr 3, 2025
This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related elastic#124395

(cherry picked from commit 2b512bc)
elasticsearchmachine pushed a commit that referenced this pull request Apr 3, 2025
#126207)

* ESQL: make `AttributeMap` and `AttributeSet` immutable (#125938)

This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related #124395

(cherry picked from commit 2b512bc)

* Update 9.0-specific AttributeSet usage
bpintea added a commit to bpintea/elasticsearch that referenced this pull request Apr 3, 2025
This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related elastic#124395

(cherry picked from commit 2b512bc)
elasticsearchmachine pushed a commit that referenced this pull request Apr 3, 2025
…6226)

This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related #124395

(cherry picked from commit 2b512bc)
andreidan pushed a commit to andreidan/elasticsearch that referenced this pull request Apr 9, 2025
This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related elastic#124395
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 >refactoring Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants