|
@@ -994,6 +994,32 @@ public abstract class RestEsqlTestCase extends ESRestTestCase {
|
|
|
assertEquals(List.of(List.of(false, 9.1), List.of(true, 8.1)), result.get("values"));
|
|
assertEquals(List.of(List.of(false, 9.1), List.of(true, 8.1)), result.get("values"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void testMultipleBatchesWithLookupJoin() throws IOException {
|
|
|
|
|
+ assumeTrue(
|
|
|
|
|
+ "Makes numberOfChannels consistent with layout map for join with multiple batches",
|
|
|
|
|
+ EsqlCapabilities.Cap.MAKE_NUMBER_OF_CHANNELS_CONSISTENT_WITH_LAYOUT.isEnabled()
|
|
|
|
|
+ );
|
|
|
|
|
+ // Create more than 10 indices to trigger multiple batches of data node execution.
|
|
|
|
|
+ // The sort field should be missing on some indices to reproduce NullPointerException caused by duplicated items in layout
|
|
|
|
|
+ for (int i = 1; i <= 20; i++) {
|
|
|
|
|
+ createIndex("idx" + i, randomBoolean(), "\"mappings\": {\"properties\" : {\"a\" : {\"type\" : \"keyword\"}}}");
|
|
|
|
|
+ }
|
|
|
|
|
+ bulkLoadTestDataLookupMode(10);
|
|
|
|
|
+ // lookup join with and without sort
|
|
|
|
|
+ for (String sort : List.of("", "| sort integer")) {
|
|
|
|
|
+ var query = requestObjectBuilder().query(format(null, "from * | lookup join {} on integer {}", testIndexName(), sort));
|
|
|
|
|
+ Map<String, Object> result = runEsql(query);
|
|
|
|
|
+ var columns = as(result.get("columns"), List.class);
|
|
|
|
|
+ assertEquals(21, columns.size());
|
|
|
|
|
+ var values = as(result.get("values"), List.class);
|
|
|
|
|
+ assertEquals(10, values.size());
|
|
|
|
|
+ }
|
|
|
|
|
+ // clean up
|
|
|
|
|
+ for (int i = 1; i <= 20; i++) {
|
|
|
|
|
+ assertThat(deleteIndex("idx" + i).isAcknowledged(), is(true));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void testErrorMessageForLiteralDateMathOverflow() throws IOException {
|
|
public void testErrorMessageForLiteralDateMathOverflow() throws IOException {
|
|
|
List<String> dateMathOverflowExpressions = List.of(
|
|
List<String> dateMathOverflowExpressions = List.of(
|
|
|
"2147483647 day + 1 day",
|
|
"2147483647 day + 1 day",
|
|
@@ -1668,6 +1694,13 @@ public abstract class RestEsqlTestCase extends ESRestTestCase {
|
|
|
return "[" + value + ", " + value + "]";
|
|
return "[" + value + ", " + value + "]";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static void createIndex(String indexName, boolean lookupMode, String mapping) throws IOException {
|
|
|
|
|
+ Request request = new Request("PUT", "/" + indexName);
|
|
|
|
|
+ String settings = "\"settings\" : {\"mode\" : \"lookup\"}, ";
|
|
|
|
|
+ request.setJsonEntity("{" + (lookupMode ? settings : "") + mapping + "}");
|
|
|
|
|
+ assertEquals(200, client().performRequest(request).getStatusLine().getStatusCode());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static RequestObjectBuilder requestObjectBuilder() throws IOException {
|
|
public static RequestObjectBuilder requestObjectBuilder() throws IOException {
|
|
|
return new RequestObjectBuilder();
|
|
return new RequestObjectBuilder();
|
|
|
}
|
|
}
|