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

   ### What changes were proposed in this pull request?
   
   This PR proposes to make `ErrorClassesJsonReader` handle null properly
   
   ### Why are the changes needed?
   
   When `ErrorClassesJsonReader` takes null for `getErrorMessage` method, it 
cannot handle so raises `INTERNAL_ERROR`.
   
   For example, given error class example below:
   
   ```json
   {
     "MISSING_PARAMETER" : {
       "message" : [
         "Parameter ${param} is missing."
       ]
     }
   }
   ```
   
   and run:
   
   ```scala
   getErrorMessage("MISSING_PARAMETER", Map("param" -> null)
   ```
   
   **Before**
   ```
   [INTERNAL_ERROR] Undefined error message parameter for error class: 
'MISSING_PARAMETER', MessageTemplate: Parameter ${param} is missing., 
Parameters: Map(param -> null) SQLSTATE: XX000
   org.apache.spark.SparkException: [INTERNAL_ERROR] Undefined error message 
parameter for error class: 'MISSING_PARAMETER', MessageTemplate: Parameter 
${param} is missing., Parameters: Map(param -> null) SQLSTATE: XX000
   ```
   
   **After**
   ```
   [MISSING_PARAMETER] Parameter null is missing.
   ```
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   No API changes, but this PR improves the user-facing error message as 
described above.
   
   ### How was this patch tested?
   
   Added UT.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.


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