You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/18 20:26:54 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4228: Fix the percentile argument for ApproxPercentileCont must be Float64, not Decimal128(2, 1)

alamb commented on code in PR #4228:
URL: https://github.com/apache/arrow-datafusion/pull/4228#discussion_r1026849681


##########
datafusion/expr/src/type_coercion/aggregates.rs:
##########
@@ -166,19 +168,22 @@ pub fn coerce_types(
                     agg_fun, input_types[0]
                 )));
             }
-            if !matches!(input_types[1], DataType::Float64) {
-                return Err(DataFusionError::Plan(format!(
-                    "The percentile argument for {:?} must be Float64, not {:?}.",
-                    agg_fun, input_types[1]
-                )));
-            }
             if input_types.len() == 3 && !is_integer_arg_type(&input_types[2]) {
                 return Err(DataFusionError::Plan(format!(
                         "The percentile sample points count for {:?} must be integer, not {:?}.",
                         agg_fun, input_types[2]
                     )));
             }
-            Ok(input_types.to_vec())
+            let mut result = input_types.to_vec();
+            if can_coerce_from(&DataType::Float64, &input_types[1]) {
+                result[1] = DataType::Float64;
+            } else {
+                return Err(DataFusionError::Plan(format!(
+                    "The percentile argument for {:?} must be Float64, not {:?}.",
+                    agg_fun, input_types[1]

Review Comment:
   ```suggestion
                       "Could not coerce the percent argument for {:?} to Float64. Was  {:?}.",
                       agg_fun, input_types[1]
   ```



##########
datafusion/physical-expr/src/aggregate/tdigest.rs:
##########
@@ -231,7 +231,6 @@ impl TDigest {
     }
 
     pub(crate) fn merge_sorted_f64(&self, sorted_values: &[f64]) -> TDigest {
-        dbg!(&sorted_values);

Review Comment:
   👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org