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 2019/10/15 09:30:52 UTC

[GitHub] [spark] wangyum commented on a change in pull request #26112: [SPARK-29364][SQL] Return an interval from date subtract according to SQL standard

wangyum commented on a change in pull request #26112: [SPARK-29364][SQL] Return an interval from date subtract according to SQL standard
URL: https://github.com/apache/spark/pull/26112#discussion_r334845680
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ##########
 @@ -849,12 +850,18 @@ object TypeCoercion {
       case Add(l @ DateType(), r @ IntegerType()) => DateAdd(l, r)
       case Add(l @ IntegerType(), r @ DateType()) => DateAdd(r, l)
       case Subtract(l @ DateType(), r @ IntegerType()) => DateSub(l, r)
-      case Subtract(l @ DateType(), r @ DateType()) => DateDiff(l, r)
-      case Subtract(l @ TimestampType(), r @ TimestampType()) => TimestampDiff(l, r)
+      case Subtract(l @ DateType(), r @ DateType()) =>
+        if (SQLConf.get.getConf(SQLConf.LEGACY_DATES_SUBTRACTION)) {
 
 Review comment:
   Could we do not add `spark.sql.legacy.datesSubtraction.enabled` and use `spark.sql.dialect` here?
   `spark.sql.dialect=SPARK` -> `SubtractDates(l, r)`
   `spark.sql.dialect=PostgreSQL` -> `DateDiff(l, r)`

----------------------------------------------------------------
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


With regards,
Apache Git Services

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