Skip to content

Commit 657fbe2

Browse files
authored
Remove dead code in WithinSeriesAggregate (#138507)
1 parent d34cf01 commit 657fbe2

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plan/logical/promql/WithinSeriesAggregate.java

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,11 @@
77

88
package org.elasticsearch.xpack.esql.plan.logical.promql;
99

10-
import org.elasticsearch.xpack.esql.core.expression.Alias;
1110
import org.elasticsearch.xpack.esql.core.expression.Expression;
12-
import org.elasticsearch.xpack.esql.core.expression.NamedExpression;
13-
import org.elasticsearch.xpack.esql.core.expression.ReferenceAttribute;
14-
import org.elasticsearch.xpack.esql.core.expression.function.Function;
1511
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
1612
import org.elasticsearch.xpack.esql.core.tree.Source;
17-
import org.elasticsearch.xpack.esql.core.type.DataType;
18-
import org.elasticsearch.xpack.esql.expression.promql.function.PromqlFunctionRegistry;
1913
import org.elasticsearch.xpack.esql.plan.logical.LogicalPlan;
20-
import org.elasticsearch.xpack.esql.plan.logical.SurrogateLogicalPlan;
21-
import org.elasticsearch.xpack.esql.plan.logical.TimeSeriesAggregate;
2214

23-
import java.util.ArrayList;
2415
import java.util.List;
2516

2617
/**
@@ -51,7 +42,7 @@
5142
* avg_over_time(cpu_usage[1h])
5243
* → TimeSeriesAggregate(groupBy: _tsid, agg: AvgOverTime(value))
5344
*/
54-
public class WithinSeriesAggregate extends PromqlFunctionCall implements SurrogateLogicalPlan {
45+
public class WithinSeriesAggregate extends PromqlFunctionCall {
5546

5647
public WithinSeriesAggregate(Source source, LogicalPlan child, String functionName, List<Expression> parameters) {
5748
super(source, child, functionName, parameters);
@@ -67,34 +58,6 @@ public WithinSeriesAggregate replaceChild(LogicalPlan newChild) {
6758
return new WithinSeriesAggregate(source(), newChild, functionName(), parameters());
6859
}
6960

70-
@Override
71-
public LogicalPlan surrogate() {
72-
LogicalPlan childPlan = child();
73-
74-
ReferenceAttribute timestampField = new ReferenceAttribute(source(), "@timestamp", DataType.DATETIME);
75-
ReferenceAttribute valueField = new ReferenceAttribute(source(), "value", DataType.DOUBLE);
76-
ReferenceAttribute tsidField = new ReferenceAttribute(source(), "_tsid", DataType.KEYWORD);
77-
78-
List<Expression> functionParams = new ArrayList<>();
79-
functionParams.add(valueField);
80-
functionParams.add(timestampField);
81-
functionParams.addAll(parameters());
82-
83-
Function esqlFunction = PromqlFunctionRegistry.INSTANCE.buildEsqlFunction(functionName(), source(), functionParams);
84-
85-
String internalName = functionName() + "_$result";
86-
Alias functionAlias = new Alias(source(), internalName, esqlFunction);
87-
88-
List<Expression> groupings = new ArrayList<>();
89-
groupings.add(tsidField);
90-
91-
List<NamedExpression> aggregates = new ArrayList<>();
92-
aggregates.add(functionAlias);
93-
aggregates.add(tsidField);
94-
95-
return new TimeSeriesAggregate(source(), childPlan, groupings, aggregates, null);
96-
}
97-
9861
// @Override
9962
// public String telemetryLabel() {
10063
// return "PROMQL_WITHIN_SERIES_AGGREGATION";

0 commit comments

Comments
 (0)