alamb commented on code in PR #6818:
URL: https://github.com/apache/arrow-datafusion/pull/6818#discussion_r1249456663
##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -557,13 +557,12 @@ impl BuiltinScalarFunction {
BuiltinScalarFunction::ConcatWithSeparator => Ok(Utf8),
BuiltinScalarFunction::DatePart => Ok(Float64),
BuiltinScalarFunction::DateBin | BuiltinScalarFunction::DateTrunc
=> {
- match input_expr_types[1] {
- Timestamp(Nanosecond, _) | Utf8 | Null => {
- Ok(Timestamp(Nanosecond, None))
- }
- Timestamp(Microsecond, _) => Ok(Timestamp(Microsecond,
None)),
- Timestamp(Millisecond, _) => Ok(Timestamp(Millisecond,
None)),
- Timestamp(Second, _) => Ok(Timestamp(Second, None)),
+ match &input_expr_types[1] {
Review Comment:
I wonder if any of the calculations actually have to change based on
timezone (as wouldn't the end of the`day` being truncated depend on the
timezone)?
##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -895,15 +894,37 @@ impl BuiltinScalarFunction {
],
self.volatility(),
),
- BuiltinScalarFunction::DateTrunc => Signature::one_of(
- vec![
- Exact(vec![Utf8, Timestamp(Nanosecond, None)]),
- Exact(vec![Utf8, Timestamp(Microsecond, None)]),
- Exact(vec![Utf8, Timestamp(Millisecond, None)]),
- Exact(vec![Utf8, Timestamp(Second, None)]),
- ],
- self.volatility(),
- ),
+ BuiltinScalarFunction::DateTrunc => {
+ let time_zones = vec![
Review Comment:
Maybe @waitingkuo has some ideas about how to deal with timezones in
function signatures.
It seems not quite right to have to list all timezones specially for
`date_trun` only -- shouldn't the timezone logic apply to any function that
takes timezones ? 🤔
--
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]