Skip to content

ESQL: Clarify inheriting from Attributes#145898

Merged
alex-spies merged 4 commits intoelastic:mainfrom
alex-spies:small-attribute-cleanups
Apr 8, 2026
Merged

ESQL: Clarify inheriting from Attributes#145898
alex-spies merged 4 commits intoelastic:mainfrom
alex-spies:small-attribute-cleanups

Conversation

@alex-spies
Copy link
Copy Markdown
Contributor

Inheriting from FieldAttribute is mildly terrifying as this class is used throughout ESQL and was essentially always assumed final (except for the UnssuportedAttribute subclass).

Let's update the javadoc to reflect that.

@elasticsearchmachine elasticsearchmachine added v9.4.0 Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) labels Apr 8, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

@ivancea ivancea requested a review from Copilot April 8, 2026 13:34
@idegtiarenko
Copy link
Copy Markdown
Contributor

except for the UnssuportedAttribute subclass

There are also
org.elasticsearch.xpack.esql.core.expression.TemporalityAttribute (added about 2 weeks ago) and org.elasticsearch.xpack.esql.core.expression.TimeSeriesMetadataAttribute (added about 4 weeks ago).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies and tightens the intended inheritance model for ES|QL Attribute implementations, reducing the risk of unexpected subclassing in core expression types.

Changes:

  • Mark ReferenceAttribute, MetadataAttribute, and EmptyAttribute as final to prevent subclassing.
  • Update FieldAttribute Javadoc to discourage new subclasses and suggest extending EsField when appropriate.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/ReferenceAttribute.java Declares ReferenceAttribute as final to prevent inheritance.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/MetadataAttribute.java Declares MetadataAttribute as final to prevent inheritance.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/FieldAttribute.java Adds Javadoc guidance to treat FieldAttribute as effectively final and prefer EsField extension.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/EmptyAttribute.java Declares EmptyAttribute as final to prevent inheritance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JonasKunz
Copy link
Copy Markdown
Contributor

There are also
org.elasticsearch.xpack.esql.core.expression.TemporalityAttribute (added about 2 weeks ago)

That one will be removed in #145902.

@alex-spies
Copy link
Copy Markdown
Contributor Author

except for the UnssuportedAttribute subclass

There are also org.elasticsearch.xpack.esql.core.expression.TemporalityAttribute (added about 2 weeks ago) and org.elasticsearch.xpack.esql.core.expression.TimeSeriesMetadataAttribute (added about 4 weeks ago).

Right! This is what triggered this PR. Already discussed with Sergey and Jonas, and opened #145903.

@alex-spies alex-spies requested review from idegtiarenko and ivancea and removed request for idegtiarenko April 8, 2026 14:58
Copy link
Copy Markdown
Contributor

@idegtiarenko idegtiarenko 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 enabled auto-merge (squash) April 8, 2026 15:27
@alex-spies alex-spies merged commit e5dc49f into elastic:main Apr 8, 2026
31 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Apr 8, 2026
…cation

* upstream/main:
  Reindex relocation: store source TaskResult at destination node (elastic#145488)
  Bump versions after 9.2.8 release
  [CI] DLMFrozenTransitionServiceTests testCheckForFrozenIndicesReturnsEarlyWhenCapacityExhausted failing [elastic#145778] (elastic#145906)
  Update branches.json for 9.2.8 release
  ESQL: Clarify inheriting from Attributes (elastic#145898)
  Bump versions after 9.3.3 release
  Update branches.json for 9.3.3 release
szybia added a commit to szybia/elasticsearch that referenced this pull request Apr 8, 2026
* upstream/main:
  Mute org.elasticsearch.xpack.esql.expression.function.aggregate.FirstDocIdGroupingAggregatorFunctionTests testSimple elastic#145923
  Reindex relocation: store source TaskResult at destination node (elastic#145488)
  Bump versions after 9.2.8 release
  [CI] DLMFrozenTransitionServiceTests testCheckForFrozenIndicesReturnsEarlyWhenCapacityExhausted failing [elastic#145778] (elastic#145906)
  Update branches.json for 9.2.8 release
  ESQL: Clarify inheriting from Attributes (elastic#145898)
  Bump versions after 9.3.3 release
  Update branches.json for 9.3.3 release
  Prune changelogs after 8.19.14 release
  Bump versions after 8.19.14 release
  Update branches.json for 8.19.14 release
  [ML] Call old inference API (elastic#145690)
  ESQL: Unmute CsvIT sumWithOverflowRow (elastic#145893)
  Index a document when testing runtime fields shadowing dimensions & metrics (elastic#145882)
  [TEST] Fix version check in testSequenceNumbersDisabled (elastic#145879)
  [ESQL] Per-file filter pushdown awareness (elastic#145755)
  Unmute testGetReindexFollowsRelocation (elastic#145841)
  Correctly ignore system indices when validating dot-prefixed indices (elastic#128868)
  [Transform] Remove tests for deleted code (elastic#145685)
  ESQL: Add generative tests for LIMIT BY (elastic#144238)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants