sdf-jkl commented on code in PR #27377:
URL: https://github.com/apache/datafusion/pull/27377#discussion_r4568642888
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -2270,6 +2270,12 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type:
&DataType) -> Option<DataTyp
(Date32, Time64(_)) | (Time64(_), Date32) =>
Some(Timestamp(Nanosecond, None)),
(Date64, Time32(_)) | (Time32(_), Date64) =>
Some(Timestamp(Nanosecond, None)),
(Date64, Time64(_)) | (Time64(_), Date64) =>
Some(Timestamp(Nanosecond, None)),
+ (Time32(lhs_unit) | Time64(lhs_unit), Time32(rhs_unit) |
Time64(rhs_unit)) => {
Review Comment:
I'd rather keep this in SLT. `s = TIME '12:34:56'` already covers
`Time32(s)` vs `Time64(ns)` for comparisons, and 9ea27bb0f adds a `s UNION ALL
t` case that checks the union resolves to `Time64(ns)`.
##########
datafusion/sqllogictest/test_files/datetime/timestamps.slt:
##########
@@ -796,6 +796,46 @@ FROM times LIMIT 1;
----
Time64(ns) Time32(s) Time32(ms) Time64(µs) Time64(ns)
+# Times with different units coerce to the finer unit, so extra digits are
Review Comment:
Added in 9ea27bb0f. It returns `Interval(MonthDayNano)` today, so the test
pins the type as well as the value.
##########
datafusion/expr-common/src/type_coercion/binary.rs:
##########
@@ -2270,6 +2270,12 @@ fn temporal_coercion(lhs_type: &DataType, rhs_type:
&DataType) -> Option<DataTyp
(Date32, Time64(_)) | (Time64(_), Date32) =>
Some(Timestamp(Nanosecond, None)),
(Date64, Time32(_)) | (Time32(_), Date64) =>
Some(Timestamp(Nanosecond, None)),
(Date64, Time64(_)) | (Time64(_), Date64) =>
Some(Timestamp(Nanosecond, None)),
+ (Time32(lhs_unit) | Time64(lhs_unit), Time32(rhs_unit) |
Time64(rhs_unit)) => {
+ match timeunit_coercion(lhs_unit, rhs_unit) {
Review Comment:
The two callers live in different crates (`datafusion-sql` and
`datafusion-expr-common`), so sharing this means a new public function in
`datafusion-common` for a four-line match.
##########
datafusion/sqllogictest/test_files/datetime/timestamps.slt:
##########
@@ -796,6 +796,46 @@ FROM times LIMIT 1;
----
Time64(ns) Time32(s) Time32(ms) Time64(µs) Time64(ns)
+# Times with different units coerce to the finer unit, so extra digits are
Review Comment:
Added in 9ea27bb0f, it checks that `s`/`us` resolves to `Time64(µs)`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]