Skip to content

Commit 38cee34

Browse files
committed
iter
1 parent bc6a7a3 commit 38cee34

File tree

4 files changed

+67
-121
lines changed

4 files changed

+67
-121
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AggregateFunction.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ public boolean hasWindow() {
170170
return true;
171171
}
172172

173-
/**
174-
* Whether the aggregate function is a wildcard aggregation (e.g., COUNT(*)).
175-
*/
176-
public boolean isWildcard() {
177-
return false;
178-
}
179-
180173
/**
181174
* Returns the set of input attributes required by this aggregate function, excluding those referenced by the filter.
182175
*/

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Count.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,6 @@ public Nullability nullable() {
142142
return Nullability.FALSE;
143143
}
144144

145-
@Override
146-
public boolean isWildcard() {
147-
Expression field = field();
148-
if (field instanceof Literal lit) {
149-
return StringUtils.WILDCARD.equals(lit.toString());
150-
}
151-
return false;
152-
}
153-
154145
@Override
155146
protected TypeResolution resolveType() {
156147
return isType(

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.xpack.esql.core.expression.Expressions;
1717
import org.elasticsearch.xpack.esql.core.expression.NamedExpression;
1818
import org.elasticsearch.xpack.esql.core.util.Holder;
19-
import org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateFunction;
2019
import org.elasticsearch.xpack.esql.plan.logical.Aggregate;
2120
import org.elasticsearch.xpack.esql.plan.logical.EsRelation;
2221
import org.elasticsearch.xpack.esql.plan.logical.Eval;
@@ -52,7 +51,6 @@ public LogicalPlan apply(LogicalPlan plan) {
5251

5352
static LogicalPlan pruneColumns(LogicalPlan plan, AttributeSet.Builder used, boolean inlineJoin) {
5453
Holder<Boolean> forkPresent = new Holder<>(false);
55-
Holder<Boolean> wildcardAgg = new Holder<>(false);
5654
// while going top-to-bottom (upstream)
5755
return plan.transformDown(p -> {
5856
// Note: It is NOT required to do anything special for binary plans like JOINs, except INLINE STATS. It is perfectly fine that
@@ -72,15 +70,6 @@ static LogicalPlan pruneColumns(LogicalPlan plan, AttributeSet.Builder used, boo
7270
return p;
7371
}
7472

75-
if (p instanceof Aggregate) {
76-
var aggs = ((Aggregate) p).aggregates();
77-
for (var agg : aggs) {
78-
if (agg.children().stream().anyMatch(x -> x instanceof AggregateFunction && ((AggregateFunction) x).isWildcard())) {
79-
wildcardAgg.set(true);
80-
break;
81-
}
82-
}
83-
}
8473
var recheck = new Holder<Boolean>();
8574
// analyze the unused items against dedicated 'producer' nodes such as Eval and Aggregate
8675
// perform a loop to retry checking if the current node is completely eliminated
@@ -94,7 +83,7 @@ static LogicalPlan pruneColumns(LogicalPlan plan, AttributeSet.Builder used, boo
9483
case EsRelation esr -> pruneColumnsInEsRelation(esr, used);
9584
case Fork fork -> {
9685
forkPresent.set(true);
97-
yield wildcardAgg.get() ? fork : pruneColumnsInFork(fork, used);
86+
yield pruneColumnsInFork(fork, used);
9887
}
9988
default -> p;
10089
};

0 commit comments

Comments
 (0)