Skip to content

Commit e27f473

Browse files
authored
[ML][Data Frame] have sum map to a double to prevent overflows (#43213)
1 parent 816f12f commit e27f473

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

x-pack/plugin/data-frame/src/main/java/org/elasticsearch/xpack/dataframe/transforms/pivot/Aggregations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum AggregationType {
3434
VALUE_COUNT("value_count", "long"),
3535
MAX("max", SOURCE),
3636
MIN("min", SOURCE),
37-
SUM("sum", SOURCE),
37+
SUM("sum", "double"),
3838
GEO_CENTROID("geo_centroid", "geo_point"),
3939
SCRIPTED_METRIC("scripted_metric", DYNAMIC),
4040
WEIGHTED_AVG("weighted_avg", DYNAMIC),

x-pack/plugin/data-frame/src/test/java/org/elasticsearch/xpack/dataframe/transforms/pivot/AggregationsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public void testResolveTargetMapping() {
3434
assertEquals("half_float", Aggregations.resolveTargetMapping("min", "half_float"));
3535

3636
// sum
37-
assertEquals("int", Aggregations.resolveTargetMapping("sum", "int"));
3837
assertEquals("double", Aggregations.resolveTargetMapping("sum", "double"));
39-
assertEquals("half_float", Aggregations.resolveTargetMapping("sum", "half_float"));
38+
assertEquals("double", Aggregations.resolveTargetMapping("sum", "half_float"));
39+
assertEquals("double", Aggregations.resolveTargetMapping("sum", null));
4040

4141
// geo_centroid
4242
assertEquals("geo_point", Aggregations.resolveTargetMapping("geo_centroid", "geo_point"));

0 commit comments

Comments
 (0)