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

   ### What changes were proposed in this pull request?
   
   Assign the name `DECIMAL_SCALE_EXCEEDS_PRECISION` to the legacy error 
condition
   `_LEGACY_ERROR_TEMP_1228`. This error is raised by
   `DataTypeErrors.decimalCannotGreaterThanPrecisionError` when a `DecimalType` 
is
   constructed with scale greater than precision. The new condition is given 
SQLSTATE
   `22003` (matching the sibling `DECIMAL_PRECISION_EXCEEDS_MAX_PRECISION`); 
the message
   text and the `scale`/`precision` parameters are unchanged.
   
   ### Why are the changes needed?
   
   The error conditions 
[README](https://github.com/apache/spark/blob/master/common/utils/src/main/resources/error/README.md)
   disallows new `_LEGACY_ERROR_TEMP_*` entries and asks existing ones to be 
assigned
   proper names. This resolves one of them, under the umbrella
   [SPARK-37935](https://issues.apache.org/jira/browse/SPARK-37935).
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. The `_LEGACY_ERROR_TEMP_*` names are not part of the public API. The 
error
   condition name changes to `DECIMAL_SCALE_EXCEEDS_PRECISION` and now reports 
SQLSTATE
   `22003`; the rendered message ("Decimal scale (`<scale>`) cannot be greater 
than
   precision (`<precision>`).") is unchanged.
   
   ### How was this patch tested?
   
   Added a `checkError` test in `DataTypeSuite` that constructs `DecimalType(2, 
3)` and
   asserts the `DECIMAL_SCALE_EXCEEDS_PRECISION` condition. 
`SparkThrowableSuite`
   validates error-file formatting/sorting and that non-legacy conditions carry 
a
   SQLSTATE.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude 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