Skip to content

Commit ccc23fc

Browse files
committed
Allow aggregate functions for dedup
1 parent a8be56f commit ccc23fc

File tree

1 file changed

+4
-1
lines changed
  • x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.elasticsearch.xpack.esql.core.util.CollectionUtils;
2121
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
2222
import org.elasticsearch.xpack.esql.plan.logical.Aggregate;
23+
import org.elasticsearch.xpack.esql.plan.logical.Dedup;
2324
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
2425

2526
import java.io.IOException;
@@ -139,7 +140,9 @@ public boolean equals(Object obj) {
139140
@Override
140141
public BiConsumer<LogicalPlan, Failures> postAnalysisPlanVerification() {
141142
return (p, failures) -> {
142-
if (p instanceof Aggregate == false) {
143+
// `dedup` for now is not exposed as a command,
144+
// so allowing aggregate functions for dedup explicitly is just an internal implementation detail
145+
if ((p instanceof Aggregate) == false && (p instanceof Dedup) == false) {
143146
p.expressions().forEach(x -> x.forEachDown(AggregateFunction.class, af -> {
144147
if (af instanceof Rate) {
145148
failures.add(fail(af, "aggregate function [{}] not allowed outside METRICS command", af.sourceText()));

0 commit comments

Comments
 (0)