prashantwason opened a new pull request, #18061:
URL: https://github.com/apache/hudi/pull/18061

   ### Describe the issue this Pull Request addresses
   
   Closes #18060
   
   When records have null values in the precombine field, Hudi jobs fail with a 
cryptic error message that makes it difficult for users to diagnose the root 
cause:
   
   ```
   org.apache.hudi.exception.HoodieException: Could not create payload for 
class: org.apache.hudi.common.model.DefaultHoodieRecordPayload
   Caused by: org.apache.hudi.exception.HoodieException: Ordering value is null 
for record: ...
   ```
   
   This error provides no actionable information about which field has the null 
value, which record is problematic, or how to remediate the issue.
   
   ### Summary and Changelog
   
   This change adds explicit null-checking with a clear, actionable error 
message before attempting payload creation in `HoodieCreateRecordUtils.scala`.
   
   **Changes:**
   - Added null-check for ordering field values in 
`HoodieCreateRecordUtils.scala`
   - The new error message identifies:
     - The specific precombine/ordering field that has a null value
     - The record key to help locate the problematic record
     - Suggested remediation options (fix data or use 
`OverwriteWithLatestAvroPayload`)
   - Added test cases in `TestHoodieCreateRecordUtils.scala` to verify the 
improved error handling
   
   **Example of improved error message:**
   ```
   Precombine/ordering field 'ts' has null value for record key 'abc123'. 
Please ensure all records have non-null values for the precombine field, or use 
a payload class that doesn't require ordering (e.g., 
OverwriteWithLatestAvroPayload).
   ```
   
   ### Impact
   
   No public API changes. This is a usability improvement that provides clearer 
error messages when data quality issues occur during ingestion.
   
   ### Risk Level
   
   low - The change only affects error handling and adds a null check before an 
operation that would fail anyway. The behavior for valid data remains unchanged.
   
   ### Documentation Update
   
   none - No new configs or features added. This is an error message 
improvement.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable


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

Reply via email to