cloud-fan commented on a change in pull request #32949:
URL: https://github.com/apache/spark/pull/32949#discussion_r666437563



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -2452,9 +2491,16 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with 
SQLConfHelper with Logg
           } else {
             values(i).getText
           }
+
           UTF8String.fromString(" " + v + " " + u)
         }
-        IntervalUtils.stringToInterval(UTF8String.concat(kvs: _*))
+        val intervalLiteral = UTF8String.concat(kvs: _*)
+        val calendarInterval = IntervalUtils.stringToInterval(intervalLiteral)
+        if (!conf.legacyIntervalEnabled && isYearMonthInterval && 
isDayTimeInterval) {
+          throw 
QueryParsingErrors.mixedIntervalUnitsError(intervalLiteral.toString.trim, ctx)

Review comment:
       it looks simpler to detect the mixed fields in 
https://github.com/apache/spark/pull/32949/files#diff-26fe6b511f4b8aedf5bdffae0d7c03aba69463c09fa4f881d77520125796e0faR2422
   
   do we have a strong reason to do it here?




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

To unsubscribe, e-mail: [email protected]

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