yaooqinn commented on a change in pull request #26702: [SPARK-30070][SQL] 
Support ANSI datetimes predicate - overlaps
URL: https://github.com/apache/spark/pull/26702#discussion_r351979119
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -246,6 +248,29 @@ class Analyzer(
       CleanupAliases)
   )
 
+  /**
+   * Replace interval with startEnd + interval and substitute child plan with 
DateTimeOverlaps.
+   */
+  object ResolveDateTimeOverlaps extends Rule[LogicalPlan] {
+    def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
+      case p: LogicalPlan => p.transformAllExpressions {
+        case u @ UnresolvedDateTimeOverlaps(leftStart, leftEnd, _, _)
+          if leftEnd.dataType.isInstanceOf[CalendarIntervalType] =>
+          u.copy(leftEnd = Add(leftStart, leftEnd))
 
 Review comment:
   SGTM. I’ll refine this 

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

Reply via email to