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_r351245908
##########
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:
hmm..., I personally think that behaivour looks a little weired to me.
Probably, the root cause is that `Subtract(l @ DateType(), r @
NullType()).checkInputDataTypes.isSuccess` returns true. To fix this issue, we
might need to modify that check code to return false. cc: @cloud-fan
----------------------------------------------------------------
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]