File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments