LuciferYang opened a new pull request, #57305:
URL: https://github.com/apache/spark/pull/57305

   ### What changes were proposed in this pull request?
   
   Convert the legacy error condition `_LEGACY_ERROR_TEMP_0031` ("Invalid 
number of buckets: <describe>.") into the 
`INVALID_SQL_SYNTAX.INVALID_BUCKET_NUMBER` subclass (SQLSTATE `42000`, 
inherited from the `INVALID_SQL_SYNTAX` umbrella).
   
   ### Why are the changes needed?
   
   The error-conditions README disallows new `_LEGACY_ERROR_TEMP_*` entries and 
asks existing ones to be resolved. This resolves one of them.
   
   The error is raised by `AstBuilder` when the first argument of a `bucket` 
partition transform is not an integer literal, e.g. `CREATE TABLE ... 
PARTITIONED BY (bucket('12', b))`. The sibling errors reported from the same 
transform-argument path -- `INVALID_SQL_SYNTAX.INVALID_COLUMN_REFERENCE` and 
`INVALID_SQL_SYNTAX.TRANSFORM_WRONG_NUM_ARGS` -- already live under the 
`INVALID_SQL_SYNTAX` umbrella, so folding this into 
`INVALID_SQL_SYNTAX.INVALID_BUCKET_NUMBER` keeps the parser syntax errors 
consistent instead of introducing a new top-level name.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Only the error condition name is assigned; the message text is 
unchanged. The `_LEGACY_ERROR_TEMP_*` names are not part of the public API.
   
   ### How was this patch tested?
   
   Added a `checkError` test in `QueryParsingErrorsSuite` that parses `CREATE 
TABLE my_tab(a INT, b STRING) USING parquet PARTITIONED BY (bucket('12', b))` 
and asserts the `INVALID_SQL_SYNTAX.INVALID_BUCKET_NUMBER` condition. 
`build/sbt "sql/testOnly *QueryParsingErrorsSuite" "core/testOnly 
org.apache.spark.SparkThrowableSuite"` passes.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


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