ESQL: Clarify inheriting from Attributes#145898
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/FieldAttribute.java
Show resolved
Hide resolved
...k/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/core/expression/FieldAttribute.java
Show resolved
Hide resolved
There are also |
There was a problem hiding this comment.
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, andEmptyAttributeasfinalto prevent subclassing. - Update
FieldAttributeJavadoc to discourage new subclasses and suggest extendingEsFieldwhen 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.
That one will be removed in #145902. |
Right! This is what triggered this PR. Already discussed with Sergey and Jonas, and opened #145903. |
…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
* 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)
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.