Skip to content

Esql dimension aware attributes #131463

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

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

not-napoleon
Copy link
Member

Relates to #128621

This PR adds more building blocks for working with dimensions in ESQL. Specifically, it makes the TSDB metadata available on attributes.

I did not add new tests for this yet. That's on purpose, as we have more components we need before we can really wire this up the way we want to.

 Conflicts:
	x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/Attribute.java
@@ -83,13 +123,8 @@ public static Reader<? extends EsField> getReader(String name) {
private final Map<String, EsField> properties;
private final String name;
private final boolean isAlias;
// Because the subclasses all reimplement serialization, this needs to be writeable from subclass constructors
Copy link
Member Author

Choose a reason for hiding this comment

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

(Comment was outdated - I ended up not reimplementing the serialization in the sub classes, but forgot to delete this in the previous PR)

timeSeriesFieldType = timeSeriesFieldType.merge(EsField.TimeSeriesFieldType.fromIndexFieldCapabilities(fc));
} catch (IllegalArgumentException e) {
return new InvalidMappedField(name, e.getMessage());
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the core thing this PR does. As we are loading the fields, we collect their time series metadata, and merge it across indices. This is then made available to the field attribute.

@@ -165,7 +165,6 @@ public void testFallbackIndicesOptions() throws Exception {
assertThat(cloned.clusterAlias(), equalTo(request.clusterAlias()));
assertThat(cloned.sessionId(), equalTo(request.sessionId()));
RemoteClusterPlan plan = cloned.remoteClusterPlan();
assertThat(plan.plan(), equalTo(request.remoteClusterPlan().plan()));
Copy link
Member Author

Choose a reason for hiding this comment

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

Test was failing on this line because plans serialized with older transport versions are not equal to plans serialized with the new transport version. This is expected, since when translating from the old version, we default the ts metadata to unknown, while the current version serializes and deserializes an actual value.

I discussed this failure with @dnhatn , and we concluded this assert wasn't adding any value in this test.

@not-napoleon not-napoleon marked this pull request as ready for review July 22, 2025 17:17
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine labels Jul 22, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@not-napoleon not-napoleon requested a review from dnhatn July 23, 2025 18:45
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

I have one question, but the changes look good. I look forward to seeing the next part. I think we might use this information only on the coordinator; hence I'm not sure if we need to serialize it, but I'm okay with this approach as well.

if (other != METRIC) {
return DIMENSION;
}
throw new IllegalStateException("Time Series Metadata conflict. Cannot merge [" + other + "] with [DIMENSION].");
Copy link
Member

Choose a reason for hiding this comment

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

To confirm, we do not allow mixing dimensions and metrics, but we do allow NONE with dimensions. I think the GAUGE type is optional - should we treat it similarly to NONE?

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 :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy