Skip to content

Commit c387814

Browse files
author
elasticsearchmachine
committed
Add tests for fields that are needed in other places than sort
1 parent a8ca463 commit c387814

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlReductionLateMaterializationTestCase.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ public void testPushdownTopNMultipleRetrievedFields() throws Exception {
137137
);
138138
}
139139

140+
public void testPushdownTopFilterOnNonProjected() throws Exception {
141+
testLateMaterializationAfterReduceTopN(
142+
"from test | where filtered > 0 | sort sorted desc | limit 3 | stats sum(read)",
143+
Set.of("sorted"),
144+
Set.of("read")
145+
);
146+
}
147+
148+
public void testPushdownTopFilterOnProjected() throws Exception {
149+
testLateMaterializationAfterReduceTopN(
150+
"from test | sort sorted desc | limit 3 | where filtered > 0 | stats sum(read)",
151+
Set.of("sorted"),
152+
Set.of("read", "filtered")
153+
);
154+
}
155+
140156
private void testLateMaterializationAfterReduceTopN(
141157
String query,
142158
Set<String> expectedDataLoadedFields,

0 commit comments

Comments
 (0)