Skip to content

Commit dd86f32

Browse files
committed
Update test
1 parent adab9f8 commit dd86f32

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/mv_expand.csv-spec

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,17 +516,21 @@ goqRirHJaE:long
516516
testPushDownMvExpandPastProject2
517517
required_capability: push_down_mv_expand_past_project
518518
from languages
519-
| eval a = 2
519+
| eval a = [1,2]
520520
| rename a AS b
521521
| sort b
522522
| mv_expand b
523523
| keep b
524524
;
525525

526526
b:integer
527+
1
527528
2
529+
1
528530
2
531+
1
529532
2
533+
1
530534
2
531535
;
532536

@@ -546,3 +550,20 @@ b:integer
546550
2
547551
2
548552
;
553+
554+
555+
testPushDownMvExpandPastProject4
556+
required_capability: push_down_mv_expand_past_project
557+
row a = [1,2,3]
558+
| eval c = a
559+
| eval a = 12
560+
| rename c as b
561+
| keep *
562+
| mv_expand b
563+
;
564+
565+
b:integer | a:integer
566+
1 | 12
567+
2 | 12
568+
3 | 12
569+
;

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,33 @@ public void testPushDownMvExpandPastProject3() {
31823182
as(limit.child(), EsRelation.class);
31833183
}
31843184

3185+
/**
3186+
* <pre>{@code
3187+
* Project[[b{r}#16 AS b#12, $$a$temp_name$17{r}#18 AS a#9]]
3188+
* \_Limit[1000[INTEGER],true,false]
3189+
* \_MvExpand[a{r}#4,b{r}#16]
3190+
* \_Eval[[12[INTEGER] AS $$a$temp_name$17#18]]
3191+
* \_Limit[1000[INTEGER],false,false]
3192+
* \_LocalRelation[[a{r}#4],Page{blocks=[IntVectorBlock[vector=ConstantIntVector[positions=1, value=2]]]}]
3193+
* }</pre>
3194+
*/
3195+
public void testPushDownMvExpandPastProject4() {
3196+
LogicalPlan plan = optimizedPlan("""
3197+
row a = 2
3198+
| eval c = a
3199+
| eval a = 12
3200+
| rename c as b
3201+
| keep *
3202+
| mv_expand b
3203+
""");
3204+
var project = as(plan, Project.class);
3205+
var limit = asLimit(project.child(), 1000, true);
3206+
var mvExpand = as(limit.child(), MvExpand.class);
3207+
var eval = as(mvExpand.child(), Eval.class);
3208+
limit = asLimit(eval.child(), 1000, false);
3209+
as(limit.child(), LocalRelation.class);
3210+
}
3211+
31853212
public void testTopNEnrich() {
31863213
LogicalPlan plan = optimizedPlan("""
31873214
from test

0 commit comments

Comments
 (0)