Skip to content

Commit 287d32d

Browse files
authored
[ESQL] Implement missing methods of TimeSeriesAggregate (#130218)
The base methods `expressionsResolved()`, `hashCode()` and `equals()` weren't checking `timeBucket`
1 parent b9360a4 commit 287d32d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.IOException;
2020
import java.util.List;
21+
import java.util.Objects;
2122

2223
/**
2324
* An extension of {@link Aggregate} to perform time-series aggregation per time-series, such as rate or _over_time.
@@ -74,8 +75,35 @@ public TimeSeriesAggregate with(LogicalPlan child, List<Expression> newGroupings
7475
return new TimeSeriesAggregate(source(), child, newGroupings, newAggregates, timeBucket);
7576
}
7677

78+
@Override
79+
public boolean expressionsResolved() {
80+
return super.expressionsResolved() && (timeBucket == null || timeBucket.resolved());
81+
}
82+
7783
@Nullable
7884
public Bucket timeBucket() {
7985
return timeBucket;
8086
}
87+
88+
@Override
89+
public int hashCode() {
90+
return Objects.hash(groupings, aggregates, child(), timeBucket);
91+
}
92+
93+
@Override
94+
public boolean equals(Object obj) {
95+
if (this == obj) {
96+
return true;
97+
}
98+
99+
if (obj == null || getClass() != obj.getClass()) {
100+
return false;
101+
}
102+
103+
TimeSeriesAggregate other = (TimeSeriesAggregate) obj;
104+
return Objects.equals(groupings, other.groupings)
105+
&& Objects.equals(aggregates, other.aggregates)
106+
&& Objects.equals(child(), other.child())
107+
&& Objects.equals(timeBucket, other.timeBucket);
108+
}
81109
}

0 commit comments

Comments
 (0)