Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,6 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT
method: test
issue: https://github.com/elastic/elasticsearch/issues/127536
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
method: test {union_types.MultiIndexSortIpStringEval ASYNC}
issue: https://github.com/elastic/elasticsearch/issues/127537
- class: org.elasticsearch.xpack.inference.action.filter.ShardBulkInferenceActionFilterIT
method: testRestart {p0=false p1=false}
issue: https://github.com/elastic/elasticsearch/issues/127592
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ public static Map<String, Object> runEsqlAsync(
String id = (String) json.get("id");

var supportsAsyncHeaders = clusterHasCapability("POST", "/_query", List.of(), List.of("async_query_status_headers")).orElse(false);
var supportsSuggestedCast = clusterHasCapability("POST", "/_query", List.of(), List.of("suggested_cast")).orElse(false);

if (id == null) {
// no id returned from an async call, must have completed immediately and without keep_on_completion
Expand Down Expand Up @@ -1334,7 +1335,14 @@ public static Map<String, Object> runEsqlAsync(

// assert initial contents, if any, are the same as async get contents
if (initialColumns != null) {
assertEquals(initialColumns, result.get("columns"));
if (supportsSuggestedCast == false) {
assertEquals(
removeOriginalTypesAndSuggestedCast(initialColumns),
removeOriginalTypesAndSuggestedCast(result.get("columns"))
);
} else {
assertEquals(initialColumns, result.get("columns"));
}
assertEquals(initialValues, result.get("values"));
}

Expand All @@ -1343,6 +1351,25 @@ public static Map<String, Object> runEsqlAsync(
return removeAsyncProperties(result);
}

private static Object removeOriginalTypesAndSuggestedCast(Object response) {
if (response instanceof ArrayList<?> columns) {
var newColumns = new ArrayList<>();
for (var column : columns) {
if (column instanceof Map<?, ?> columnMap) {
var newMap = new HashMap<>(columnMap);
newMap.remove("original_types");
newMap.remove("suggested_cast");
newColumns.add(newMap);
} else {
newColumns.add(column);
}
}
return newColumns;
} else {
return response;
}
}

public void testAsyncGetWithoutContentType() throws IOException {
int count = randomIntBetween(0, 100);
bulkLoadTestData(count);
Expand Down