Skip to content

Commit 41d2119

Browse files
committed
More stuff
1 parent a88b8cf commit 41d2119

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pushDownSort_To_LeftSideOnly
256256
required_capability: inlinestats_v8
257257

258258
from employees
259-
| sort emp_no desc
259+
| sort emp_no
260260
| inlinestats avg = avg(salary) by languages
261261
| limit 5
262262
| keep emp_no, avg, languages, gender
@@ -270,13 +270,6 @@ from employees
270270
10005 |63528.0 |1 |M
271271
;
272272

273-
from employees
274-
| sort emp_no desc
275-
| inlinestats avg = avg(salary) by languages
276-
| limit 5
277-
| keep emp_no, avg, languages, gender
278-
;
279-
280273
byMultivaluedSimple
281274
required_capability: inlinestats_v8
282275

@@ -1196,11 +1189,10 @@ FROM employees
11961189
| INLINESTATS salary = min(salary) BY gender
11971190
| WHERE salary > 31000
11981191
| INLINESTATS salary = max(salary) BY gender
1199-
| WHERE salary > 31500
1192+
| WHERE salary < 31500
12001193
| KEEP salary, gender
12011194
| SORT salary DESC, gender
12021195
;
1203-
warning:No limit defined, adding default limit of [1000]
12041196

12051197
salary:integer |gender:keyword
12061198
31120 |null
@@ -1225,7 +1217,7 @@ FROM employees
12251217
| LIMIT 3
12261218
;
12271219

1228-
emp_no:integer |salary:integer |languages:integer|avg(salary):double|gender:keyword
1220+
emp_no:integer |salary:integer |languages:integer|avg(salary):double|gender:long
12291221
10001 |57305 |2 |48248.55 |2
12301222
10002 |56371 |5 |48248.55 |2
12311223
10003 |61805 |4 |48248.55 |2

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.elasticsearch.xpack.esql.rule.Rule;
3030

3131
import java.util.ArrayList;
32-
import java.util.Collections;
3332
import java.util.List;
3433

3534
/**
@@ -105,15 +104,16 @@ public LogicalPlan apply(LogicalPlan plan) {
105104
p = aggregate.with(aggregate.groupings(), remaining);
106105
}
107106
}
108-
} else if (p instanceof InlineJoin ij) {// TODO: InlineStats - add tests for this IJ removal
109-
var remaining = removeUnused(ij.right().output(), used, Collections.emptyList());
107+
} else if (p instanceof InlineJoin ij) {// TODO: InlineStats - add unit tests for this IJ removal
108+
var remaining = removeUnused(ij.right().output(), used, inlineJoinRightOutput);
110109
if (remaining != null) {
111110
if (remaining.isEmpty()) {
112111
// remove the InlineJoin altogether
113112
p = ij.left();
114113
recheck = true;
115114
}
116-
// TODO: InlineStats - prune only the unused columns from it?
115+
// TODO: InlineStats - prune ONLY the unused output columns from it? In other words, don't perform more aggs
116+
// if they will not be used anyway
117117
}
118118
} else if (p instanceof Eval eval) {
119119
var remaining = removeUnused(eval.fields(), used, inlineJoinRightOutput);

0 commit comments

Comments
 (0)