cloud-fan commented on code in PR #58852:
URL: https://github.com/apache/spark/pull/58852#discussion_r4057018674


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala:
##########
@@ -5199,7 +5199,7 @@ case class TimeBucket(
     ts: Expression,
     originTs: Expression,
     timeZoneId: Option[String] = None)
-  extends TernaryExpression with ExpectsInputTypes with 
TimeZoneAwareExpression {
+  extends TernaryExpression with ImplicitCastInputTypes with 
TimeZoneAwareExpression {

Review Comment:
   **Non-blocking (P2):** Switching the whole expression to 
`ImplicitCastInputTypes` also applies coercion to `bucketSize`. In ANSI mode, 
`StringType` can implicitly cast to any `AtomicType`, and `DayTimeIntervalType` 
is atomic, so a call with a string such as `'0 00:15:00'` becomes accepted 
while legacy mode still rejects it. This broadens the public contract beyond 
the intended timestamp/origin arguments and makes the new unchanged-bucket-size 
rule assertion fail. Could we keep `bucketSize` outside generic implicit 
casting and validate it explicitly as an interval while retaining coercion for 
`ts` and `originTs`?



-- 
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]

Reply via email to