maropu commented on a change in pull request #26412: [SPARK-29774][SQL] Date
and Timestamp type +/- null should be null as Postgres
URL: https://github.com/apache/spark/pull/26412#discussion_r351231434
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
##########
@@ -858,14 +858,19 @@ object TypeCoercion {
b.withNewChildren(Seq(Cast(l, CalendarIntervalType), r))
case Add(l @ DateType(), r @ IntegerType()) => DateAdd(l, r)
+ case Add(l @ DateType(), r @ NullType()) => DateAdd(l, Cast(r,
IntegerType))
case Add(l @ IntegerType(), r @ DateType()) => DateAdd(r, l)
+ case Add(l @ NullType(), r @ DateType()) => DateAdd(r, Cast(l,
IntegerType))
case Subtract(l @ DateType(), r @ IntegerType()) => DateSub(l, r)
+ case Subtract(l @ DateType(), r @ NullType()) => DateSub(l, Cast(r,
IntegerType))
case Subtract(l @ DateType(), r @ DateType()) =>
Review comment:
Can we merge the multiple rule above into one like this?
```
case b @ BinaryOperator(l @ DateType(), r @ NullType()) =>
b.withNewChildren(Seq(l, Cast(r, IntegerType)))
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]