cloud-fan commented on code in PR #57008:
URL: https://github.com/apache/spark/pull/57008#discussion_r3573411484
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -4281,20 +4281,55 @@ case class ConvertTimezone(
Seq(
StringTypeWithCollation(supportsTrimCollation = true),
StringTypeWithCollation(supportsTrimCollation = true),
- TimestampNTZType)
- override def dataType: DataType = TimestampNTZType
+ TypeCollection(TimestampNTZType, AnyTimestampNanoType))
Review Comment:
Non-blocking (message-only): the wrong-type error advertises
`TIMESTAMP_LTZ(P)` as an acceptable source, but the guard just below rejects
LTZ nanos. When the source is a wholly-invalid type (e.g. an int), the mismatch
comes from the generic `super.checkInputDataTypes()` over this
`TypeCollection`, whose `requiredType` renders as `"(TIMESTAMP_NTZ OR
(TIMESTAMP_LTZ(P) OR TIMESTAMP_NTZ(P) WITH P IN [7, 9]))"` — because
`AnyTimestampNanoType.simpleString` lists `timestamp_ltz(p)`. That's the
opposite of the `checkInputDataTypes` guard's own (correctly narrowed)
`requiredType`, so the two error paths disagree on whether LTZ is accepted. No
wrong result, and there's no clean one-liner fix (it needs a custom message or
a narrower `AbstractDataType`), so just flagging it.
--
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]