MaxGekk commented on code in PR #56677:
URL: https://github.com/apache/spark/pull/56677#discussion_r3460521035
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala:
##########
@@ -158,6 +158,14 @@ object Cast extends QueryErrorsBase {
case (_: TimeType, _: TimeType) => true
case (_: TimeType, _: IntegralType) => true
+ // TIME(p) <-> TIMESTAMP_NTZ(q), q in [6, 9] (precision 6 is the micro
TimestampNTZType,
+ // [7, 9] is TimestampNTZNanosType). Restricted to the NTZ family on
purpose: TIMESTAMP_LTZ
+ // is not a valid counterpart for these casts.
+ case (_: TimeType, TimestampNTZType) => true
Review Comment:
Good catch — agreed and fixed. TimeType is a DatetimeType, so these were
falling through the (_: DatetimeType, _: DatetimeType) catch-all and becoming
silent store assignments, which contradicts both the UNION/CASE
negative-coercion guard (b33c635) and the explicit-only policy the adjacent
nanos arms (SPARK-57293/57323/57490) enforce. Added four explicit => false arms
above the catch-all plus store-assignment negative assertions for both
directions of the micro and nanos pairs. These conversions are
explicit-CAST-only by design.
--
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]