-
Notifications
You must be signed in to change notification settings - Fork 25.7k
ESQL: Enable new data types with created version #136327
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
Changes from 6 commits
57b63c2
3b5c4e2
ac6efb9
ad8b9b9
fb665c1
8b22742
a7d19df
5016b73
8e2d031
47590a1
0527749
e9b20c8
dd895a1
b86a096
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -32,6 +32,7 @@ | |||||
| import java.io.IOException; | ||||||
| import java.util.ArrayList; | ||||||
| import java.util.Arrays; | ||||||
| import java.util.Comparator; | ||||||
| import java.util.List; | ||||||
| import java.util.Locale; | ||||||
| import java.util.Map; | ||||||
|
|
@@ -43,6 +44,7 @@ | |||||
| import static org.elasticsearch.test.ListMatcher.matchesList; | ||||||
| import static org.elasticsearch.test.MapMatcher.assertMap; | ||||||
| import static org.elasticsearch.test.MapMatcher.matchesMap; | ||||||
| import static org.elasticsearch.xpack.esql.action.EsqlResolveFieldsResponse.RESOLVE_FIELDS_RESPONSE_CREATED_TV; | ||||||
| import static org.hamcrest.Matchers.any; | ||||||
| import static org.hamcrest.Matchers.anyOf; | ||||||
| import static org.hamcrest.Matchers.containsString; | ||||||
|
|
@@ -76,11 +78,6 @@ public class AllSupportedFieldsTestCase extends ESRestTestCase { | |||||
|
|
||||||
| @ParametersFactory(argumentFormatting = "pref=%s mode=%s") | ||||||
| public static List<Object[]> args() { | ||||||
| if (Build.current().isSnapshot()) { | ||||||
| // We only test behavior in release builds. Snapshot builds will have data types enabled that are still under construction. | ||||||
| return List.of(); | ||||||
| } | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this. |
||||||
|
|
||||||
| List<Object[]> args = new ArrayList<>(); | ||||||
| for (MappedFieldType.FieldExtractPreference extractPreference : Arrays.asList( | ||||||
| null, | ||||||
|
|
@@ -102,7 +99,7 @@ protected AllSupportedFieldsTestCase(MappedFieldType.FieldExtractPreference extr | |||||
| this.indexMode = indexMode; | ||||||
| } | ||||||
|
|
||||||
| protected record NodeInfo(String cluster, String id, TransportVersion version, Set<String> roles) {} | ||||||
| protected record NodeInfo(String cluster, String id, boolean snapshot, TransportVersion version, Set<String> roles) {} | ||||||
|
|
||||||
| private static Map<String, NodeInfo> nodeToInfo; | ||||||
|
|
||||||
|
|
@@ -126,6 +123,19 @@ protected boolean fetchDenseVectorAggMetricDoubleIfFns() throws IOException { | |||||
| return clusterHasCapability("GET", "/_query", List.of(), List.of("DENSE_VECTOR_AGG_METRIC_DOUBLE_IF_FNS")).orElse(false); | ||||||
| } | ||||||
|
|
||||||
| private static Boolean denseVectorAggMetricDoubleIfVersion; | ||||||
|
|
||||||
| private boolean denseVectorAggMetricDoubleIfVersion() throws IOException { | ||||||
| if (denseVectorAggMetricDoubleIfVersion == null) { | ||||||
| denseVectorAggMetricDoubleIfVersion = fetchDenseVectorAggMetricDoubleIfVersion(); | ||||||
| } | ||||||
| return denseVectorAggMetricDoubleIfVersion; | ||||||
| } | ||||||
|
|
||||||
| protected boolean fetchDenseVectorAggMetricDoubleIfVersion() throws IOException { | ||||||
| return clusterHasCapability("GET", "/_query", List.of(), List.of("DENSE_VECTOR_AGG_METRIC_DOUBLE_IF_VERSION")).orElse(false); | ||||||
| } | ||||||
|
|
||||||
| private static Boolean supportsNodeAssignment; | ||||||
|
|
||||||
| protected boolean supportsNodeAssignment() throws IOException { | ||||||
|
|
@@ -154,10 +164,12 @@ protected static Map<String, NodeInfo> fetchNodeToInfo(RestClient client, String | |||||
| Map<?, ?> nodeInfo = (Map<?, ?>) n.getValue(); | ||||||
| String nodeName = (String) extractValue(nodeInfo, "name"); | ||||||
| TransportVersion transportVersion = TransportVersion.fromId((Integer) extractValue(nodeInfo, "transport_version")); | ||||||
| String version = (String) extractValue(nodeInfo, "version"); | ||||||
| boolean snapshot = nodeInfo.toString().contains(version + "-SNAPSHOT"); | ||||||
| List<?> roles = (List<?>) nodeInfo.get("roles"); | ||||||
| nodeToInfo.put( | ||||||
| nodeName, | ||||||
| new NodeInfo(cluster, id, transportVersion, roles.stream().map(Object::toString).collect(Collectors.toSet())) | ||||||
| new NodeInfo(cluster, id, snapshot, transportVersion, roles.stream().map(Object::toString).collect(Collectors.toSet())) | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -175,6 +187,14 @@ public void createIndices() throws IOException { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| @Before | ||||||
| public void onlyOnSnapshot() throws IOException { | ||||||
|
||||||
| public void onlyOnSnapshot() throws IOException { | |
| public void onlyOnProductionBuilds() throws IOException { |
Outdated
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.
Interesting! I thought that running tests in release mode will use release builds of all bwc versions as well. Is that not the case?
Can we add a comment to explain this? Also, should we double check our release tests whether they always should use release builds of bwc versions?
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'll add a comment, yeah. If you run:
./gradlew -p x-pack/plugin/esql/qa/server/multi-clusters/ clean v9.1.5#newToOld -Dbuild.snapshot=false -Dlicense.key="x-pack/license-tools/src/test/resources/public.key" -Dtests.jvm.argline="-Dbuild.snapshot=false" -Dtests.class='*All*'
while 9.1.5 is the tip of the 9.1 branch then we'll compile 9.1 and run it as a snapshot.
I'll ask around if this is intended.
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'll ask around if this is intended.
Well, not "intended", but not something we're likely to fix right now.
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.
We could use a similar test for aggregate metric double, no?
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.
👍
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 change effectively adds support to agg metric double and dense vector fields in lookup indices and enrich policies.
Let's add a test case for using all kinds of types as lookup/enrich fields, right? (Not match fields, we have separate tests for that.) In a follow-up that is, this should be fine to merge without.
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.
👍