gengliangwang commented on code in PR #40616:
URL: https://github.com/apache/spark/pull/40616#discussion_r1156313326
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala:
##########
@@ -1171,6 +1172,29 @@ object TypeCoercion extends TypeCoercionBase {
}
}
+ // For legacy support. For example: string type +/- interval.
+ object ResolveBinaryArithmetic extends TypeCoercionRule {
+ override val transform: PartialFunction[Expression, Expression] =
+ AnsiTypeCoercion.ResolveBinaryArithmetic.transform.andThen {
+ case a @ Add(l, r, _) if a.childrenResolved => (l.dataType,
r.dataType) match {
+ case (StringType | _: NumericType | BinaryType | BooleanType,
+ CalendarIntervalType | _: DayTimeIntervalType) =>
+ Cast(TimeAdd(l, r), l.dataType)
Review Comment:
The first child of `TimeAdd` has to be `AnyTimestampType` but it can be
`StringType | _: NumericType | BinaryType | BooleanType` here..
--
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]