cloud-fan 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_r352583163
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -246,6 +247,54 @@ class Analyzer(
CleanupAliases)
)
+ /**
+ * 1. Turns Add/Subtract of DateType/TimestampType/StringType and
CalendarIntervalType
Review comment:
I think we need to carefully design the rule so that it's easy to reason
about. How about
```
For `UnresolvedAdd`:
1. if one side is interval, turn it into `TimeAdd`
2. if one side is date, turn it into `DateAdd`
3. otherwise, turn it into `Add`
For `UnresolvedSubtract`:
1. if the right side is interval, turn it into `TimeSub`
2. if one side is timestamp, turn in into `SubtractTimestamps`
3. if one side is date, turn it into `DateDiff`/`SubtractDates`
4. otherwise, turn it into `Subtract`
```
----------------------------------------------------------------
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]