linliu-code opened a new pull request, #19709:
URL: https://github.com/apache/hudi/pull/19709

   ### Describe the issue this Pull Request addresses
   
   Closes #19708
   
   ### Summary and Changelog
   
   `SqlKeyGenerator#getPartitionPath(GenericRecord)` resolved the partition 
path through
   `BaseKeyGenerator#getKey`, which is `new HoodieKey(getRecordKey(record), 
getPartitionPath(record))`,
   so asking for a partition path also validated the record key. That broke 
`MERGE INTO` with a partial
   `UPDATE SET` on MOR with a global bloom or simple index, where 
`HoodieIndexUtils#inferPartitionPath`
   asks for the partition path of a merged record materialised against 
`WRITE_PARTIAL_UPDATE_SCHEMA`
   (only the assigned columns), leaving the record key legitimately unset.
   
   Resolve the partition path directly when the delegate is a 
`BaseKeyGenerator`, keeping the previous
   `getKey` path otherwise, since `SparkKeyGeneratorInterface` exposes no Avro 
accessor beyond `getKey`.
   `getPartitionPathFields` in this class already uses that construct. Adds 
`TestSqlKeyGenerator`
   covering partition resolution with the record key unset (fails on master), 
record-key resolution
   still rejecting a missing key, and a complete record.
   
   ### Impact
   
   Fixes partial-update `MERGE INTO` on the affected configuration. 
`getRecordKey` and `getKey` are
   untouched, so record-key validation is unchanged and no call that already 
succeeded behaves
   differently.
   
   ### Risk Level
   
   low
   
   One method, strictly more permissive. Verified on this branch: the new test 
fails on the parent
   commit with `HoodieKeyException` and passes here; 
`TestPartialUpdateForMergeInto`,
   `TestMergeIntoTable` and `TestMergeIntoTable2` pass (60 tests); checkstyle 
and scalastyle clean.
   
   Fixing this exposes a second, previously unreachable problem on the same 
path, where the
   partial-update merged record is serialized against a mismatched schema and 
raises
   `UnresolvedUnionException` from `BaseAvroPayload#getRecordBytes`. It has a 
distinct cause in the
   payload path and is left for a follow-up, with the end-to-end coverage of 
that shape.
   
   ### 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