dtenedor commented on code in PR #60588:
URL: https://github.com/apache/spark/pull/60588#discussion_r4619065237


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -5791,6 +5850,11 @@
           "LATERAL can only be used with subquery and table-valued functions."
         ]
       },
+      "MULTIPLE_FROM_TO_INTERVAL_UNITS" : {

Review Comment:
   Fixed in 6788da3010d. I kept one subcondition, because the rule and the fix 
are the same for all three shapes, and renamed it to 
`INVALID_SQL_SYNTAX.FROM_TO_INTERVAL_WITH_OTHER_UNITS` with this message:
   
   > A from-to unit range, such as '1-2' YEAR TO MONTH, must be the only unit 
specification in an interval literal. Write the interval either as one from-to 
unit range or in multi-unit syntax, for example INTERVAL 1 YEAR 2 MONTHS.
   
   The factory is now `fromToIntervalWithOtherUnitsError`. The regenerated 
`interval.sql` golden files (ANSI mode on and off) record the new name for all 
seven from-to queries, which cover the three shapes, and nothing references 
`MULTIPLE_FROM_TO_INTERVAL_UNITS` anymore.
   



##########
sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -477,8 +480,8 @@ private[sql] object QueryParsingErrors extends 
DataTypeErrorsBase {
 
   def mixedIntervalUnitsError(literal: String, ctx: ParserRuleContext): 
Throwable = {
     new ParseException(
-      errorClass = "_LEGACY_ERROR_TEMP_0029",
-      messageParameters = Map("literal" -> literal),
+      errorClass = 
"INVALID_INTERVAL_FORMAT.MIXED_YEAR_MONTH_AND_DAY_TIME_FIELDS",
+      messageParameters = Map("input" -> literal),

Review Comment:
   Fixed in 6788da3010d. `constructMultiUnitsIntervalLiteral` now takes the 
interval text to report. The typed `INTERVAL '...'` path passes the string 
value. For the multi-unit path, I moved the string building out of 
`visitMultiUnitsInterval` into a `multiUnitsIntervalString` helper, so the 
error shows the same unit-value text that `stringToInterval` parses, without 
SQL quotes or the INTERVAL keyword. For example, `-interval '-1 month 1 day -1 
second'` now reports `-1 month 1 day -1 second`, and `interval '30' year '25' 
month '-100' day '40' hour ...` reports `30 year 25 month -100 day 40 hour 
...`. `ExpressionParserSuite` and the `interval.sql` and `cast.sql` golden 
files are updated.
   



##########
sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala:
##########
@@ -745,23 +760,27 @@ private[sql] object QueryParsingErrors extends 
DataTypeErrorsBase {
   }
 
   def invalidTimeZoneDisplacementValueError(ctx: SetTimeZoneContext): 
Throwable = {
-    new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0045", ctx)
+    new ParseException(errorClass = 
"INVALID_SQL_SYNTAX.SET_TIME_ZONE_INVALID_VALUE", ctx)
   }
 
   def createTempTableNotSpecifyProviderError(ctx: CreateTableContext): 
Throwable = {
-    new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0046", ctx)
+    new ParseException(errorClass = 
"INVALID_SQL_SYNTAX.CREATE_TEMP_TABLE_WITHOUT_PROVIDER", ctx)
   }
 
   def rowFormatNotUsedWithStoredAsError(ctx: CreateTableLikeContext): 
Throwable = {
-    new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0047", ctx)
+    new ParseException(errorClass = 
"INVALID_SQL_SYNTAX.ROW_FORMAT_SERDE_WITHOUT_STORED_AS", ctx)
   }
 
   def useDefinedRecordReaderOrWriterClassesError(ctx: ParserRuleContext): 
Throwable = {
-    new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0048", ctx)
+    new ParseException(errorClass = 
"UNSUPPORTED_FEATURE.TRANSFORM_RECORD_READER_WRITER", ctx)

Review Comment:
   Removed in 6788da3010d.
   



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