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


##########
datafusion/expr/src/type_coercion/aggregates.rs:
##########
@@ -480,7 +480,7 @@ pub fn is_avg_support_arg_type(arg_type: &DataType) -> bool 
{
         _ => matches!(
             arg_type,
             arg_type if NUMERICS.contains(arg_type)
-                || matches!(arg_type, DataType::Decimal128(_, _))
+                || matches!(arg_type, DataType::Decimal128(_, _)| 
DataType::Decimal256(_, _))

Review Comment:
   Doesn't this change imply that people can run `AVG(dec256_col)` now? I tried 
to run this query
   
   
   ```sql
   create table t as values (arrow_cast(123, 'Decimal256'));
   select AVG(column1) from t;
   ```
   
   But it seems like datafusion support for Decimal256 is still in progress
   
   ```
   ❯ create table t as values (arrow_cast(123, 'Decimal256(10,3)'));
   Optimizer rule 'simplify_expressions' failed
   caused by
   This feature is not implemented: Can't create a scalar from array of type 
"Decimal256(10, 3)"
   ```



##########
datafusion/expr/src/type_coercion/aggregates.rs:
##########
@@ -480,7 +480,7 @@ pub fn is_avg_support_arg_type(arg_type: &DataType) -> bool 
{
         _ => matches!(
             arg_type,
             arg_type if NUMERICS.contains(arg_type)
-                || matches!(arg_type, DataType::Decimal128(_, _))
+                || matches!(arg_type, DataType::Decimal128(_, _)| 
DataType::Decimal256(_, _))

Review Comment:
   Doesn't this change imply that people can run `AVG(dec256_col)` now? I tried 
to run this query
   
   
   ```sql
   create table t as values (arrow_cast(123, 'Decimal256'));
   select AVG(column1) from t;
   ```
   
   But it seems like datafusion support for Decimal256 is still in progress
   
   ```
   ❯ create table t as values (arrow_cast(123, 'Decimal256(10,3)'));
   Optimizer rule 'simplify_expressions' failed
   caused by
   This feature is not implemented: Can't create a scalar from array of type 
"Decimal256(10, 3)"
   ```



-- 
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