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

   ### Describe the issue this Pull Request addresses
   
   Closes HUDI-3989
   
   During delete operations, if the schema read from the commit metadata (from 
a replacecommit file) is an empty string, the operation fails even when valid 
schema exists in earlier commits.
   
   ### Summary and Changelog
   
   - Changed `setWriteSchemaForDeletes` in `BaseHoodieWriteClient` to use 
`TableSchemaResolver.getTableSchemaIfPresent()` for schema resolution
   - This method walks through commits in reverse chronological order to find 
one with a valid schema, instead of only checking the last commit
   - Added explicit check to throw a clear error if deletes are issued without 
any prior commits
   - Only resolves schema if `config.getSchema()` is empty, preserving existing 
behavior when schema is already set
   
   ### Impact
   
   No public API changes. Internal behavior improvement that makes delete 
operations more robust when the most recent commit doesn't have schema in its 
metadata.
   
   ### Risk Level
   
   low - The change uses existing, well-tested `TableSchemaResolver` 
infrastructure. The fallback behavior is the same as what's used elsewhere in 
the codebase for schema resolution.
   
   ### Documentation Update
   
   none
   
   ### 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