diff --git a/datafusion/expr/src/built_in_function.rs b/datafusion/expr/src/built_in_function.rs index 114aa29aee132..ffdd51dfd5d0a 100644 --- a/datafusion/expr/src/built_in_function.rs +++ b/datafusion/expr/src/built_in_function.rs @@ -548,8 +548,7 @@ impl BuiltinScalarFunction { BuiltinScalarFunction::Concat => Ok(Utf8), BuiltinScalarFunction::ConcatWithSeparator => Ok(Utf8), BuiltinScalarFunction::DatePart => Ok(Float64), - // DateTrunc always makes nanosecond timestamps - BuiltinScalarFunction::DateTrunc | BuiltinScalarFunction::DateBin => { + BuiltinScalarFunction::DateBin | BuiltinScalarFunction::DateTrunc => { match input_expr_types[1] { Timestamp(Nanosecond, _) | Utf8 => Ok(Timestamp(Nanosecond, None)), Timestamp(Microsecond, _) => Ok(Timestamp(Microsecond, None)), diff --git a/datafusion/physical-expr/src/datetime_expressions.rs b/datafusion/physical-expr/src/datetime_expressions.rs index b946fb0e8d5ce..01e76a3a3f2df 100644 --- a/datafusion/physical-expr/src/datetime_expressions.rs +++ b/datafusion/physical-expr/src/datetime_expressions.rs @@ -396,9 +396,8 @@ pub fn date_trunc(args: &[ColumnarValue]) -> Result { } } _ => { - println!("{}, {:?}", granularity, array); return Err(DataFusionError::Execution( - "second argument of `date_trunc` must be nanosecond timestamp scalar or array array".to_string(), + "second argument of `date_trunc` must be nanosecond timestamp scalar or array".to_string(), )); } })