diff --git a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushExpressionToLoadIT.java b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushExpressionToLoadIT.java index 0bdfdb4f838a1..8afbab7537b6f 100644 --- a/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushExpressionToLoadIT.java +++ b/x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/PushExpressionToLoadIT.java @@ -442,21 +442,14 @@ public void testLengthPushedWithTopN() throws IOException { matchesList().item(matchesMap().entry("name", "test").entry("type", any(String.class))), Map.of( "data", - Build.current().isSnapshot() - ? List.of(matchesMap().entry("ordering:column_at_a_time:IntsFromDocValues.Singleton", 1)) - : List.of( - matchesMap().entry("ordering:column_at_a_time:IntsFromDocValues.Singleton", 1) - .entry("test:column_at_a_time:BytesRefsFromOrds.Singleton", 1) - ), + List.of(matchesMap().entry("ordering:column_at_a_time:IntsFromDocValues.Singleton", 1)), "node_reduce", - Build.current().isSnapshot() - ? List.of( - // Pushed down function - matchesMap().entry("test:column_at_a_time:Utf8CodePointsFromOrds.Singleton", 1), - // Field - matchesMap().entry("test:column_at_a_time:BytesRefsFromOrds.Singleton", 1) - ) - : List.of(matchesMap().entry("test:row_stride:BytesRefsFromOrds.Singleton", 1)) + List.of( + // Pushed down function + matchesMap().entry("test:column_at_a_time:Utf8CodePointsFromOrds.Singleton", 1), + // Field + matchesMap().entry("test:column_at_a_time:BytesRefsFromOrds.Singleton", 1) + ) ), sig -> assertMap( sig, @@ -514,25 +507,20 @@ public void testLengthPushedWithTopNAsOrder() throws IOException { */ public void testLengthNotPushedToLookupJoinKeyword() throws IOException { initLookupIndex(); - test( - b -> b.startObject("main_matching").field("type", "keyword").endObject(), - b -> b.field("main_matching", "lookup"), - """ - | LOOKUP JOIN lookup ON matching == main_matching - | EVAL test = LENGTH(test) - """, - matchesList().item(1), - matchesMap().entry("main_matching:column_at_a_time:BytesRefsFromOrds.Singleton", 1), - sig -> assertMap( + test(b -> b.startObject("main_matching").field("type", "keyword").endObject(), b -> b.field("main_matching", "lookup"), """ + | LOOKUP JOIN lookup ON matching == main_matching + | EVAL test = LENGTH(test) + """, matchesList().item(1), matchesMap().entry("main_matching:column_at_a_time:BytesRefsFromOrds.Singleton", 1), sig -> { + assertMap( sig, matchesList().item("LuceneSourceOperator") .item("ValuesSourceReaderOperator") // the real work is here, checkOperatorProfile checks the status - .item("StreamingLookupOperator") + .item(lookupOperatorName()) .item("EvalOperator") // this one just renames the field .item("AggregationOperator") .item("ExchangeSinkOperator") - ) - ); + ); + }); } /** @@ -546,25 +534,21 @@ public void testLengthNotPushedToLookupJoinKeywordSameName() throws IOException test(b -> { b.startObject("test").field("type", "keyword").endObject(); b.startObject("main_matching").field("type", "keyword").endObject(); - }, - b -> b.field("test", value).field("main_matching", "lookup"), - """ - | DROP test - | LOOKUP JOIN lookup ON matching == main_matching - | EVAL test = LENGTH(test) - """, - matchesList().item(1), - matchesMap().entry("main_matching:column_at_a_time:BytesRefsFromOrds.Singleton", 1), - sig -> assertMap( + }, b -> b.field("test", value).field("main_matching", "lookup"), """ + | DROP test + | LOOKUP JOIN lookup ON matching == main_matching + | EVAL test = LENGTH(test) + """, matchesList().item(1), matchesMap().entry("main_matching:column_at_a_time:BytesRefsFromOrds.Singleton", 1), sig -> { + assertMap( sig, matchesList().item("LuceneSourceOperator") .item("ValuesSourceReaderOperator") // the real work is here, checkOperatorProfile checks the status - .item("StreamingLookupOperator") + .item(lookupOperatorName()) .item("EvalOperator") // this one just renames the field .item("AggregationOperator") .item("ExchangeSinkOperator") - ) - ); + ); + }); } /** @@ -948,6 +932,10 @@ private void initLookupIndex() throws IOException { assertThat(entityToMap(bulkResponse.getEntity(), XContentType.JSON), matchesMap().entry("errors", false).extraOk()); } + private static String lookupOperatorName() { + return Build.current().isSnapshot() ? "StreamingLookupOperator" : "LookupOperator"; + } + private CheckedConsumer justType(String type) { return justType("test", type); }