Skip to content

Commit

Permalink
[Transform] weighted avg should map to double (elastic#64586)
Browse files Browse the repository at this point in the history
weighted avg like avg returns always a double value, this changes changes the output mapping from
dynamic to double
  • Loading branch information
Hendrik Muhs authored Nov 4, 2020
1 parent f1e9aec commit 281ae6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ enum AggregationType {
GEO_CENTROID("geo_centroid", GEO_POINT),
GEO_BOUNDS("geo_bounds", GEO_SHAPE),
SCRIPTED_METRIC("scripted_metric", DYNAMIC),
WEIGHTED_AVG("weighted_avg", DYNAMIC),
WEIGHTED_AVG("weighted_avg", DOUBLE),
BUCKET_SELECTOR("bucket_selector", DYNAMIC),
BUCKET_SCRIPT("bucket_script", DYNAMIC),
PERCENTILES("percentiles", DOUBLE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ public void testResolveTargetMapping() {
assertEquals("_dynamic", TransformAggregations.resolveTargetMapping("bucket_selector", "int"));

// weighted_avg
assertEquals("_dynamic", TransformAggregations.resolveTargetMapping("weighted_avg", null));
assertEquals("_dynamic", TransformAggregations.resolveTargetMapping("weighted_avg", "double"));
assertEquals("double", TransformAggregations.resolveTargetMapping("weighted_avg", null));
assertEquals("double", TransformAggregations.resolveTargetMapping("weighted_avg", "double"));
assertEquals("double", TransformAggregations.resolveTargetMapping("weighted_avg", "int"));

// percentile
assertEquals("double", TransformAggregations.resolveTargetMapping("percentiles", null));
Expand Down

0 comments on commit 281ae6c

Please sign in to comment.