uros-b commented on code in PR #57223:
URL: https://github.com/apache/spark/pull/57223#discussion_r3645271755
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -145,6 +145,14 @@ object TypeCoercion extends TypeCoercionBase {
=> if (conf.castDatetimeToString) Some(st) else Some(TimestampType)
case (TimestampType, st: StringType)
=> if (conf.castDatetimeToString) Some(st) else Some(TimestampType)
+ // Mirror the micros TimestampType (LTZ) arms above: nanos
TIMESTAMP_LTZ(p) honors
+ // castDatetimeToString. Nanos TIMESTAMP_NTZ(p) intentionally has no arm
here and, exactly like
+ // micros TimestampNTZType, falls through to the config-blind
canPromoteAsInBinaryComparison
+ // line below -- so the LTZ and NTZ families stay consistent across micros
and nanos.
+ case (st: StringType, tsNanos: TimestampLTZNanosType)
+ => if (conf.castDatetimeToString) Some(st) else Some(tsNanos)
+ case (tsNanos: TimestampLTZNanosType, st: StringType)
+ => if (conf.castDatetimeToString) Some(st) else Some(tsNanos)
Review Comment:
Please check - the new range arms make nanos TIMESTAMP_NTZ(p) honor
castDatetimeToString, but micros TimestampNTZType has no arm here and stays
config-blind (falls through to canPromoteAsInBinaryComparison, verified in
master). So under legacy castDatetimeToString=true, non-ANSI range comparison,
string < ts_ntz_micros stays a timestamp comparison while string <
ts_ntz_nanos(9) becomes lexicographic string comparison. Is this intentional?
--
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]