domodwyer commented on a change in pull request #1539:
URL: https://github.com/apache/arrow-datafusion/pull/1539#discussion_r782342982



##########
File path: datafusion/src/physical_plan/aggregates.rs
##########
@@ -122,6 +125,7 @@ pub fn return_type(
             coerced_data_types[0].clone(),
             true,
         )))),
+        AggregateFunction::ApproxQuantile => Ok(DataType::Float64),

Review comment:
       Tdigest always returns a float, but I can cast this back to the original 
type - 
[snowflake](https://docs.snowflake.com/en/sql-reference/functions/approx_percentile.html)
 always returns a double/float64 for this method, but [Google's 
BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators),
 [AWS's 
RedShift](https://docs.aws.amazon.com/redshift/latest/dg/r_APPROXIMATE_PERCENTILE_DISC.html)
 and 
[Postgres](https://www.postgresql.org/docs/9.4/functions-aggregate.html#FUNCTIONS-ORDEREDSET-TABLE)
 returns the original input type.
   
   I guess most people return the input expr type - happy to do the same - I 
will push a commit soon 👍 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to