-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
base: main
Are you sure you want to change the base?
Esql dimension aware attributes #131463
Conversation
Conflicts: docs/reference/query-languages/esql/kibana/docs/operators/is_null.md
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 |
There was a problem hiding this comment.
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()); | ||
} |
There was a problem hiding this comment.
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())); |
There was a problem hiding this comment.
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.
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this 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]."); |
There was a problem hiding this comment.
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?
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.