Skip to content

Commit a80be88

Browse files
committed
Tests update
1 parent d403e76 commit a80be88

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ FROM employees
918918
| INLINESTATS max_salary = MAX(salary), min_salary = MIN(salary) by languages
919919
| KEEP emp_no, languages, *salary
920920
| WHERE salary > 65000 and languages > 2
921+
| SORT emp_no
921922
;
922923

923924
emp_no:integer |languages:integer|salary:integer |max_salary:integer|min_salary:integer
@@ -938,16 +939,16 @@ FROM employees
938939
| INLINESTATS max_salary = MAX(salary), min_salary = MIN(salary) by languages
939940
| KEEP emp_no, languages, *salary
940941
| WHERE min_salary > 27000 or max_salary < 70000
942+
| sort salary desc
941943
| limit 5
942-
| sort salary
943944
;
944945

945946
emp_no:integer |languages:integer|salary:integer |max_salary:integer|min_salary:integer
946-
10004 |5 |36174 |66817 |25324
947-
10002 |5 |56371 |66817 |25324
948-
10001 |2 |57305 |73578 |29175
949-
10003 |4 |61805 |74572 |27215
947+
10029 |null |74999 |74999 |28336
950948
10007 |4 |74572 |74572 |27215
949+
10027 |null |73851 |74999 |28336
950+
10099 |2 |73578 |73578 |29175
951+
10078 |2 |69904 |73578 |29175
951952
;
952953

953954
filterOnInlineStatsAggsValues_And_Groupings
@@ -957,14 +958,14 @@ FROM employees
957958
| INLINESTATS max_salary = MAX(salary), min_salary = MIN(salary) by languages
958959
| KEEP emp_no, languages, *salary
959960
| WHERE (min_salary > 27000 or max_salary < 70000) and languages > 3
960-
| limit 5
961961
| sort salary
962+
| limit 5
962963
;
963964

964965
emp_no:integer |languages:integer|salary:integer |max_salary:integer|min_salary:integer
965-
10004 |5 |36174 |66817 |25324
966-
10010 |4 |45797 |74572 |27215
967-
10002 |5 |56371 |66817 |25324
968-
10003 |4 |61805 |74572 |27215
969-
10007 |4 |74572 |74572 |27215
966+
10015 |5 |25324 |66817 |25324
967+
10035 |5 |25945 |66817 |25324
968+
10057 |4 |27215 |74572 |27215
969+
10011 |5 |31120 |66817 |25324
970+
10066 |5 |31897 |66817 |25324
970971
;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/rules/logical/PushDownAndCombineFilters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ protected LogicalPlan rule(Filter filter) {
8787
plan = orderBy.replaceChild(filter.with(orderBy.child(), condition));
8888
} else if (child instanceof Join join && child instanceof InlineJoin == false) {
8989
// TODO: could we do better here about pushing down filters for inlinestats?
90+
// See also https://github.com/elastic/elasticsearch/issues/127497
91+
// Push down past INLINESTATS if the condition is on the groupings
9092
return pushDownPastJoin(filter, join);
9193
}
9294
// cannot push past a Limit, this could change the tailing result set returned

0 commit comments

Comments
 (0)