MaxGekk commented on a change in pull request #32209:
URL: https://github.com/apache/spark/pull/32209#discussion_r615686580



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -2306,12 +2307,30 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with SQLConfHelper with Logg
   }
 
   /**
-   * Create a [[CalendarInterval]] literal expression. Two syntaxes are 
supported:
+   * Create a [[CalendarInterval]] or ANSI interval literal expression.
+   * Two syntaxes are supported:
    * - multiple unit value pairs, for instance: interval 2 months 2 days.
    * - from-to unit, for instance: interval '1-2' year to month.
    */
   override def visitInterval(ctx: IntervalContext): Literal = withOrigin(ctx) {
-    Literal(parseIntervalLiteral(ctx), CalendarIntervalType)
+    val calendarInterval = parseIntervalLiteral(ctx)
+    if (ctx.errorCapturingUnitToUnitInterval != null && 
!conf.legacyIntervalEnabled) {
+      // Check the `to` unit to distinguish year-month and day-time intervals 
because

Review comment:
       I think we will have to do that at the end to support all combinations 
of `to` and `from` + precision ( `like INTERVAL '1 2:3:4.123' DAY(6) TO 
SECOND(3)`). But for now, we implement simplest possible solution to unblock 
other sub-tasks needed for Milestone 1 in SPARK-27790. The Milestone 1 supposes 
feature parity of new ANSI types with `CalendarIntervalType`. 




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to