@@ -218,7 +218,7 @@ emp_no:integer |avg_worked_seconds:long|avg_avg_worked_seconds:double|languages:
21821810007 |393084805 |2.863684210555556E8 |4 |5 |F
219219;
220220
221- three-Ignore
221+ three
222222required_capability: inlinestats_v8
223223// fails with AssertionError at org.elasticsearch.xpack.esql.plan.logical.Limit.writeTo(Limit.java:70)
224224
@@ -312,16 +312,28 @@ FROM airports
312312// end::extreme-airports-result[]
313313;
314314
315- brokenwhy-Ignore
315+ mvMinMvExpand
316316required_capability: join_planning_v1
317+ required_capability: inlinestats_v8
317318
318319FROM airports
320+ | EVAL original_type = type
319321| INLINESTATS min_scalerank=MIN(scalerank) BY type
320322| MV_EXPAND type
321- | WHERE scalerank == MV_MIN(scalerank);
323+ | EVAL mvMin_scalerank = MV_MIN(scalerank)
324+ | WHERE scalerank == MV_MIN(scalerank)
325+ | SORT abbrev DESC NULLS LAST
326+ | LIMIT 7
327+ ;
322328
323- abbrev:keyword | type:keyword | scalerank:integer | min_scalerank:integer
324- GWL | [mid, military] | 9 | [2, 4]
329+ abbrev:keyword |city:keyword |city_location:geo_point |country:keyword| location:geo_point | name:text |scalerank:integer|original_type:keyword |min_scalerank:integer|type:keyword|mvMin_scalerank:integer
330+ ZRH |Zürich |POINT (8.5411 47.3744) |Switzerland |POINT (8.56221279534765 47.4523895064915) |Zurich Int'l |3 |major |2 |major |3
331+ ZNZ |Zanzibar |POINT (39.199 -6.165) |Tanzania |POINT (39.2223319841558 -6.21857034620282)|Zanzibar |4 |mid |2 |mid |4
332+ ZLO |Cihuatlán |POINT (-104.5667 19.25) |Mexico |POINT (-104.560095200097 19.1480860285854)|Playa de Oro Int'l |7 |mid |2 |mid |7
333+ ZHHH |Wuhan |POINT (114.2881 30.5872)|China |POINT (114.24694737615 30.6017141196702) |Wang-Chia Tun Airbase|6 |[mid, military] |[2, 4] |mid |6
334+ ZHHH |Wuhan |POINT (114.2881 30.5872)|China |POINT (114.24694737615 30.6017141196702) |Wang-Chia Tun Airbase|6 |[mid, military] |[2, 4] |military |6
335+ ZGC |Lanzhou |POINT (103.8318 36.0617)|China |POINT (103.615415363043 36.5078842461237) |Lanzhou Zhongchuan |6 |mid |2 |mid |6
336+ ZAR |Zaria |POINT (7.7 11.0667) |Nigeria |POINT (7.68726764310577 11.1352958601071) |Zaria |8 |mid |2 |mid |8
325337;
326338
327339afterStats
@@ -627,11 +639,10 @@ abbrev:keyword | scalerank:integer | location:geo_point
627639 ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | 2 | 20 | -100
628640;
629641
630- byTwoCalculatedSecondOverwrites-Ignore
642+ byTwoCalculatedSecondOverwrites
631643required_capability: join_planning_v1
632644required_capability: stats_alias_collision_warnings
633- // fails with
634- // line 1:78: Plan [InlineJoin[LEFT,[x{r}#20, x{r}#23],[x{r}#20, x{r}#23],[x{r}#23, x{r}#23]]] optimized incorrectly due to missing references from left hand side [x{r}#20]
645+ required_capability: inlinestats_v8
635646
636647FROM airports
637648| WHERE abbrev IS NOT NULL
@@ -644,18 +655,16 @@ FROM airports
644655;
645656warning:Line 5:4: Field 'x' shadowed by field at line 6:3
646657
647- abbrev:keyword | scalerank:integer | location:geo_point | x:double | min_sl:integer
648- ZRH | 3 | POINT(8.56221279534765 47.4523895064915) | 10 | 2
649- ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | 40 | 2
650- ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | -100 | 2
658+ abbrev:keyword | scalerank:integer | location:geo_point | min_sl:integer| x:double
659+ ZRH | 3 | POINT (8.56221279534765 47.4523895064915) | 2 | 10
660+ ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | 2 | 40
661+ ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | 2 | -100
651662;
652663
653- byTwoCalculatedSecondOverwritesReferencingFirst-Ignore
664+ byTwoCalculatedSecondOverwritesReferencingFirst
654665required_capability: join_planning_v1
655666required_capability: stats_alias_collision_warnings
656- // fails with
657- // line 1:105: Plan [Aggregate[[x{r}#45],[MIN(scalerank{f}#50,true[BOOLEAN]) AS min_sl, x{r}#45]]] optimized incorrectly due to missing references [x{r}#45]
658- // line 1:105: Plan [InlineJoin[LEFT,[x{r}#42, x{r}#45],[x{r}#42, x{r}#45],[x{r}#45, x{r}#45]]] optimized incorrectly due to missing references from left hand side [x{r}#42]
667+ required_capability: inlinestats_v8
659668
660669FROM airports
661670| WHERE abbrev IS NOT NULL
@@ -669,35 +678,33 @@ FROM airports
669678;
670679warning:Line 6:4: Field 'x' shadowed by field at line 7:3
671680
672- abbrev:keyword | scalerank:integer | location:geo_point | x:double | min_sl:integer
673- ZRH | 3 | POINT(8.56221279534765 47.4523895064915) | 10 | 2
674- ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | 40 | 2
675- ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | -100 | 2
681+ abbrev:keyword | scalerank:integer | location:geo_point | min_sl:integer| x:double
682+ ZRH | 3 | POINT (8.56221279534765 47.4523895064915) | 2 | 10
683+ ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | 2 | 40
684+ ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | 2 | -100
676685;
677686
678687
679- groupShadowsAgg-Ignore
688+ groupShadowsAgg
680689required_capability: join_planning_v1
681690required_capability: stats_alias_collision_warnings
682- // fails with
683- // line 1:134: column [location] cannot be used as an aggregate once declared in the STATS BY grouping key [lat_10 = ROUND(ST_Y(location), -1)]
691+ required_capability: inlinestats_v8
684692
685693FROM airports
686694| WHERE abbrev IS NOT NULL
687695| KEEP abbrev, scalerank, location
688696| INLINESTATS min_sl=MIN(scalerank)
689- , lat_10 = ROUND(ST_Y(location), -1)
690- BY lat_10 = ROUND(ST_Y(location), -1)
697+ BY min_sl = ROUND(ST_Y(location), -1)
691698 , lon_10 = ROUND(ST_X(location), -1)
692699| SORT abbrev DESC
693700| LIMIT 3
694701;
695- warning:Line 5:3 : Field 'lat_10 ' shadowed by field at line 6 :4
702+ warning:Line 4:15 : Field 'min_sl ' shadowed by field at line 5 :4
696703
697- abbrev:keyword | scalerank:integer | location:geo_point | lat_10 :double | lon_10:double | min_sl:integer
698- ZRH | 3 | POINT(8.56221279534765 47.4523895064915) | 50 | 10 | 2
699- ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | -10 | 40 | 4
700- ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | 20 | -100 | 2
704+ abbrev:keyword | scalerank:integer | location:geo_point | min_sl :double | lon_10:double
705+ ZRH | 3 | POINT(8.56221279534765 47.4523895064915) | 50 | 10
706+ ZNZ | 4 | POINT (39.2223319841558 -6.21857034620282) | -10 | 40
707+ ZLO | 7 | POINT (-104.560095200097 19.1480860285854) | 20 | -100
701708;
702709
703710groupShadowsField
@@ -1106,3 +1113,81 @@ null |25324
11061113F |25324
11071114M |25324
11081115;
1116+
1117+ renamingGroupingWithItself
1118+ required_capability: inlinestats_v8
1119+
1120+ FROM employees
1121+ | EVAL x = gender
1122+ | INLINESTATS min_sl = MIN(salary) BY x = x
1123+ | SORT salary DESC
1124+ | KEEP salary, x, gender, min_sl, emp_no
1125+ | LIMIT 5
1126+ ;
1127+
1128+ salary:integer |x:keyword|gender:keyword |min_sl:integer |emp_no:integer
1129+ 74999 |M |M |25945 |10029
1130+ 74970 |M |M |25945 |10045
1131+ 74572 |F |F |25976 |10007
1132+ 73851 |F |F |25976 |10027
1133+ 73717 |null |null |25324 |10019
1134+ ;
1135+
1136+ overridingGroupings
1137+ required_capability: inlinestats_v8
1138+
1139+ FROM employees
1140+ | INLINESTATS min_sl = MIN(salary) BY x = gender, x = languages
1141+ | KEEP salary, x, gender, min_sl, emp_no
1142+ | SORT salary
1143+ | LIMIT 5
1144+ ;
1145+ warning:Line 2:39: Field 'x' shadowed by field at line 2:51
1146+
1147+ salary:integer |x:integer |gender:keyword |min_sl:integer |emp_no:integer
1148+ 25324 |5 |null |25324 |10015
1149+ 25945 |5 |M |25324 |10035
1150+ 25976 |1 |F |25976 |10092
1151+ 26436 |3 |M |26436 |10048
1152+ 27215 |4 |F |27215 |10057
1153+ ;
1154+
1155+ overridingExpressionGroupings
1156+ required_capability: inlinestats_v8
1157+
1158+ FROM employees
1159+ | INLINESTATS min_sl = MIN(salary) BY x = TO_LOWER(gender), x = CONCAT(gender, gender)
1160+ | SORT salary DESC
1161+ | KEEP salary, x, gender, min_sl, emp_no
1162+ | LIMIT 5
1163+ ;
1164+ warning:Line 2:39: Field 'x' shadowed by field at line 2:61
1165+
1166+ salary:integer |x:keyword |gender:keyword |min_sl:integer |emp_no:integer
1167+ 74999 |MM |M |25945 |10029
1168+ 74970 |MM |M |25945 |10045
1169+ 74572 |FF |F |25976 |10007
1170+ 73851 |FF |F |25976 |10027
1171+ 73717 |null |null |25324 |10019
1172+ ;
1173+
1174+ reusingEvalExpressions_UsedInGroupings
1175+ required_capability: inlinestats_v8
1176+
1177+ FROM employees
1178+ | KEEP salary, gender, emp_no
1179+ | EVAL x = TO_LOWER(gender), x = CONCAT(x, " ", x)
1180+ | INLINESTATS min_sl = MIN(salary) BY x
1181+ | SORT salary DESC
1182+ | LIMIT 5
1183+ ;
1184+
1185+ salary:integer |gender:keyword |emp_no:integer |min_sl:integer | x:keyword
1186+ 74999 |M |10029 |25945 |m m
1187+ 74970 |M |10045 |25945 |m m
1188+ 74572 |F |10007 |25976 |f f
1189+ 73851 |F |10027 |25976 |f f
1190+ 73717 |null |10019 |25324 |null
1191+ ;
1192+
1193+
0 commit comments