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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala
##########
@@ -210,6 +212,20 @@ object QueryParsingErrors {
     new ParseException(s"Intervals FROM $from TO $to are not supported.", ctx)
   }
 
+  def mixedIntervalUnitsError(ctx: IntervalContext): Throwable = {
+    new ParseException(
+      "year-month, day-time and non-ANSI interval units cannot be mixed", ctx)
+  }
+
+  def unsupportedIntervalUnitError(ctx: IntervalContext): Throwable = {
+    val supportedUnits =
+      
(YearMonthIntervalType.yearMonthFields.map(YearMonthIntervalType.fieldToString) 
++
+        
DayTimeIntervalType.dayTimeFields.map(DayTimeIntervalType.fieldToString) ++
+        IntervalUtils.nonAnsiIntervalUnits)
+        .mkString("[", ", ", "]")
+    new ParseException(s"Only $supportedUnits are supported for interval 
units", ctx)

Review comment:
       nit: it's too verbose to list all the supported fields. How about
   ```
   'ABC' is not a valid interval field: INTERVAL 1 ABC
   ```




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