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


##########
datafusion/expr/src/function.rs:
##########
@@ -218,7 +218,9 @@ pub fn return_type(
         BuiltinScalarFunction::Concat => Ok(DataType::Utf8),
         BuiltinScalarFunction::ConcatWithSeparator => Ok(DataType::Utf8),
         BuiltinScalarFunction::DatePart => Ok(DataType::Float64),
-        BuiltinScalarFunction::DateTrunc | BuiltinScalarFunction::DateBin => {
+        // DateTrunc always makes nanosecond timestamps
+        BuiltinScalarFunction::DateTrunc => 
Ok(DataType::Timestamp(TimeUnit::Nanosecond, None)),

Review Comment:
   This change makes the declared types consistent with the actual 
implementation
   
   
https://github.com/alamb/arrow-datafusion/blob/main/datafusion/physical-expr/src/datetime_expressions.rs#L266
   
   I think it is a reasonable question if `date_trunc` should be changed to 
return the same type as its input, but the current implementation always 
creates nanosecond timestamps
   
   



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