alamb opened a new pull request #9970:
URL: https://github.com/apache/arrow/pull/9970


   # Rationale:
   If you try and aggregate (via SUM, for example) a column of a timestamp 
type, DataFusion generates an error:
   ```
   Coercion from [Timestamp(Nanosecond, None)] to the signature Uniform(1, 
[Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float32, Float64]) 
failed.
   ```
   
   For example, from IOx
   
   ```
   > show columns from t;
   
+---------------+--------------+------------+-------------+-----------------------------+-------------+
   | table_catalog | table_schema | table_name | column_name | data_type        
           | is_nullable |
   
+---------------+--------------+------------+-------------+-----------------------------+-------------+
   | datafusion    | public       | t          | a           | Utf8             
           | NO          |
   | datafusion    | public       | t          | b           | 
Timestamp(Nanosecond, None) | NO          |
   
+---------------+--------------+------------+-------------+-----------------------------+-------------+
   2 row in set. Query took 0 seconds.
   > select sum(b) from t;
   Plan("Coercion from [Timestamp(Nanosecond, None)] to the signature 
Uniform(1, [Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float32, 
Float64]) failed.")
   {code}
   
   # Changes:
   Add support for aggregating timestamp types and tests for same
   
   # Notes
   Note this is follow on / more fleshing out of the work done in #9773 by 
@velvia (👋  thanks for adding Timestamps to `ScalarValue`)
   
   I will track supporting AVG on timestamps in another ticket. It is more 
involved (as currently Avg assumes the output type is always F64), and not 
important for myuse casee at the moment.
   
   
   


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

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


Reply via email to