viirya commented on code in PR #6632:
URL: https://github.com/apache/arrow-datafusion/pull/6632#discussion_r1225918413
##########
datafusion/expr/src/function.rs:
##########
@@ -221,17 +221,17 @@ pub fn return_type(
BuiltinScalarFunction::Concat => Ok(Utf8),
BuiltinScalarFunction::ConcatWithSeparator => Ok(Utf8),
BuiltinScalarFunction::DatePart => Ok(Float64),
- BuiltinScalarFunction::DateTrunc | BuiltinScalarFunction::DateBin => {
- match input_expr_types[1] {
- Timestamp(Nanosecond, _) | Utf8 => Ok(Timestamp(Nanosecond,
None)),
- Timestamp(Microsecond, _) => Ok(Timestamp(Microsecond, None)),
- Timestamp(Millisecond, _) => Ok(Timestamp(Millisecond, None)),
- Timestamp(Second, _) => Ok(Timestamp(Second, None)),
- _ => Err(DataFusionError::Internal(format!(
- "The {fun} function can only accept timestamp as the
second arg."
- ))),
- }
- }
+ // DateTrunc always makes nanosecond timestamps
+ BuiltinScalarFunction::DateTrunc => Ok(Timestamp(Nanosecond, None)),
Review Comment:
I guess that it is before because the second argument in `DateTrunc`
signature is `Timestamp(Nanosecond, None)`. So it doesn't cause issue before?
--
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]