Skip to content

Commit 0a748c5

Browse files
committed
Cleans up method that cannot be found in this version
1 parent ca1e15c commit 0a748c5

File tree

2 files changed

+25
-42
lines changed
  • x-pack/plugin/esql
    • qa/testFixtures/src/main/resources
    • src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate

2 files changed

+25
-42
lines changed

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

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,20 +3100,16 @@ STD_DEV(a):double | STD_DEV(b):double
31003100

31013101
sumWithConditions
31023102
required_capability: stats_with_filtered_surrogate_fixed
3103-
required_capability: aggregate_metric_double_convert_to
31043103

31053104
FROM employees
3106-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(1)
31073105
| STATS sum1 = SUM(1),
31083106
sum2 = SUM(1) WHERE emp_no == 10080,
31093107
sum3 = SUM(1) WHERE emp_no < 10080,
3110-
sum4 = SUM(1) WHERE emp_no >= 10080,
3111-
sum5 = SUM(agg_metric),
3112-
sum6 = SUM(agg_metric) WHERE emp_no == 10080
3108+
sum4 = SUM(1) WHERE emp_no >= 10080
31133109
;
31143110

3115-
sum1:long | sum2:long | sum3:long | sum4:long | sum5:double | sum6:double
3116-
100 | 1 | 79 | 21 | 100.0 | 1.0
3111+
sum1:long | sum2:long | sum3:long | sum4:long
3112+
100 | 1 | 79 | 21
31173113
;
31183114

31193115
weightedAvgWithConditions
@@ -3135,65 +3131,52 @@ w_avg1:double | w_avg2:double | w_avg3:double | w_avg4:double | w_avg5:double |
31353131

31363132
maxWithConditions
31373133
required_capability: stats_with_filtered_surrogate_fixed
3138-
required_capability: aggregate_metric_double_convert_to
31393134

31403135
ROW x = [1, 2, 3, 4, 5]
31413136
| MV_EXPAND x
3142-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
3143-
| STATS max1 = MAX(agg_metric) WHERE x <= 3,
3144-
max2 = MAX(agg_metric),
3145-
max3 = MAX(x),
3146-
max4 = MAX(x) WHERE x > 3
3137+
| STATS max1 = MAX(x),
3138+
max2 = MAX(x) WHERE x > 3
31473139
;
31483140

3149-
max1:double | max2:double | max3:integer | max4:integer
3150-
3.0 | 5.0 | 5 | 5
3141+
max1:integer | max2:integer
3142+
5 | 5
31513143
;
31523144

31533145
minWithConditions
31543146
required_capability: stats_with_filtered_surrogate_fixed
3155-
required_capability: aggregate_metric_double_convert_to
31563147

31573148
ROW x = [1, 2, 3, 4, 5]
31583149
| MV_EXPAND x
3159-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
3160-
| STATS min1 = MIN(agg_metric) WHERE x <= 3,
3161-
min2 = MIN(agg_metric),
3162-
min3 = MIN(x),
3163-
min4 = MIN(x) WHERE x > 3
3150+
| STATS min1 = MIN(x),
3151+
min2 = MIN(x) WHERE x > 3
31643152
;
31653153

3166-
min1:double | min2:double | min3:integer | min4:integer
3167-
1.0 | 1.0 | 1 | 4
3154+
min1:integer | min2:integer
3155+
1 | 4
31683156
;
31693157

31703158
countWithConditions
31713159
required_capability: stats_with_filtered_surrogate_fixed
3172-
required_capability: aggregate_metric_double_convert_to
31733160

31743161
ROW x = [1, 2, 3, 4, 5]
31753162
| MV_EXPAND x
3176-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
31773163
| STATS count1 = COUNT(x) WHERE x >= 3,
31783164
count2 = COUNT(x),
3179-
count3 = COUNT(agg_metric),
3180-
count4 = COUNT(agg_metric) WHERE x >=3,
3181-
count5 = COUNT(4) WHERE x >= 3,
3182-
count6 = COUNT(*) WHERE x >= 3,
3183-
count7 = COUNT([1,2,3]) WHERE x >= 3,
3184-
count8 = COUNT([1,2,3])
3165+
count3 = COUNT(4) WHERE x >= 3,
3166+
count4 = COUNT(*) WHERE x >= 3,
3167+
count5 = COUNT([1,2,3]) WHERE x >= 3,
3168+
count6 = COUNT([1,2,3])
31853169
;
31863170

3187-
count1:long | count2:long | count3:long | count4:long | count5:long | count6:long | count7:long | count8:long
3188-
3 | 5 | 5 | 3 | 3 | 3 | 9 | 15
3171+
count1:long | count2:long | count3:long | count4:long | count5:long | count6:long
3172+
3 | 5 | 3 | 3 | 9 | 15
31893173
;
31903174

31913175
countDistinctWithConditions
31923176
required_capability: stats_with_filtered_surrogate_fixed
31933177

31943178
ROW x = [1, 2, 3, 4, 5]
31953179
| MV_EXPAND x
3196-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
31973180
| STATS count1 = COUNT_DISTINCT(x) WHERE x <= 3,
31983181
count2 = COUNT_DISTINCT(x),
31993182
count3 = COUNT_DISTINCT(1) WHERE x <= 3,
@@ -3206,19 +3189,15 @@ count1:long | count2:long | count3:long | count4:long
32063189

32073190
avgWithConditions
32083191
required_capability: stats_with_filtered_surrogate_fixed
3209-
required_capability: aggregate_metric_double_convert_to
32103192

32113193
ROW x = [1, 2, 3, 4, 5]
32123194
| MV_EXPAND x
3213-
| EVAL agg_metric = TO_AGGREGATE_METRIC_DOUBLE(x)
32143195
| STATS avg1 = AVG(x) WHERE x <= 3,
3215-
avg2 = AVG(x),
3216-
avg3 = AVG(agg_metric) WHERE x <=3,
3217-
avg4 = AVG(agg_metric)
3196+
avg2 = AVG(x)
32183197
;
32193198

3220-
avg1:double | avg2:double | avg3:double | avg4:double
3221-
2.0 | 3.0 | 2.0 | 3.0
3199+
avg1:double | avg2:double
3200+
2.0 | 3.0
32223201
;
32233202

32243203
percentileWithConditions

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ public Expression surrogate() {
139139
var s = source();
140140
var field = field();
141141
if (field.dataType() == AGGREGATE_METRIC_DOUBLE) {
142-
return new Sum(s, FromAggregateMetricDouble.withMetric(source(), field, AggregateMetricDoubleBlockBuilder.Metric.SUM));
142+
return new Sum(
143+
s,
144+
FromAggregateMetricDouble.withMetric(source(), field, AggregateMetricDoubleBlockBuilder.Metric.SUM),
145+
filter()
146+
);
143147
}
144148

145149
// SUM(const) is equivalent to MV_SUM(const)*COUNT(*).

0 commit comments

Comments
 (0)