Skip to content

Commit 7bbad91

Browse files
committed
Update LogicalPlanOptimizerTests
1 parent b5f15b3 commit 7bbad91

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,6 +2779,24 @@ private static List<String> orderNames(TopN topN) {
27792779
return topN.order().stream().map(o -> as(o.child(), NamedExpression.class).name()).toList();
27802780
}
27812781

2782+
/**
2783+
* Expects
2784+
* Eval[[2[INTEGER] AS x]]
2785+
* \_Limit[1000[INTEGER],false]
2786+
* \_LocalRelation[[{e}#9],[ConstantNullBlock[positions=1]]]
2787+
*/
2788+
public void testEvalAfterStats() {
2789+
var plan = optimizedPlan("""
2790+
ROW foo = 1
2791+
| STATS x = max(foo)
2792+
| EVAL x = 2
2793+
""");
2794+
var eval = as(plan, Eval.class);
2795+
var limit = as(eval.child(), Limit.class);
2796+
var localRelation = as(limit.child(), LocalRelation.class);
2797+
assertThat(Expressions.names(eval.output()), contains("x"));
2798+
}
2799+
27822800
public void testCombineLimitWithOrderByThroughFilterAndEval() {
27832801
LogicalPlan plan = optimizedPlan("""
27842802
from test

0 commit comments

Comments
 (0)