You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/23 07:27:17 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #33033: [WIP][SPARK-35852][SQL] Use DateAdd instead of TimeAdd for DateType + INTERVAL DAY

AngersZhuuuu commented on a change in pull request #33033:
URL: https://github.com/apache/spark/pull/33033#discussion_r656829882



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -349,8 +350,16 @@ class Analyzer(override val catalogManager: CatalogManager)
       case p: LogicalPlan => p.transformExpressionsUpWithPruning(
         _.containsPattern(BINARY_ARITHMETIC), ruleId) {
         case a @ Add(l, r, f) if a.childrenResolved => (l.dataType, r.dataType) match {
-          case (DateType, _: DayTimeIntervalType) => TimeAdd(Cast(l, TimestampType), r)
-          case (_: DayTimeIntervalType, DateType) => TimeAdd(Cast(r, TimestampType), l)
+          case (DateType, dit: DayTimeIntervalType) => if (dit == DayTimeIntervalType(DAY)) {

Review comment:
       ```
   case (DateType, DayTimeIntervalType(DAY, DAY))
   case (DateType, _: DayTimeIntervalType)
   ```

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -366,8 +375,11 @@ class Analyzer(override val catalogManager: CatalogManager)
           case _ => a
         }
         case s @ Subtract(l, r, f) if s.childrenResolved => (l.dataType, r.dataType) match {
-          case (DateType, _: DayTimeIntervalType) =>
+          case (DateType, dit: DayTimeIntervalType) => if (dit == DayTimeIntervalType(DAY)) {

Review comment:
       ditto




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org