danny0405 opened a new pull request, #19874: URL: https://github.com/apache/hudi/pull/19874
### Describe the issue this Pull Request addresses Native log data and delete writes call `getRecordKey(recordSchema, keyFieldName)`, with the configured record-key field property passed as one field name when `populateMetaFields=false`. A composite key configuration such as `id,name` is not a single schema field and cannot be reconstructed through that fallback. The append path already receives records carrying their generated `HoodieKey`, including log-compaction records, and `prependMetaFields()` preserves that key. The existing Avro, Spark, and Flink overloads already prefer the stored key, so this change makes that contract explicit rather than claiming composite-key writes always failed previously. ### Summary and Changelog - Use `record.getRecordKey()` for native data and delete writes. - Remove the unused `keyFieldName` argument and caller-side key-field selection. - Document the incoming-key requirement and update common/Flink append-handle tests. - Add parameterized coverage verifying the full composite key reaches the data writer and the constructed native delete row, with metadata fields enabled and disabled. Validation: 19 tests passed across `TestHoodieNativeLogFormatWriter`, `TestHoodieNativeLogAppendHandle`, `TestFileGroupReaderBasedNativeLogAppendHandle`, and `TestFlinkNativeLogAppendHandle`. Maven reactor build, Checkstyle, and Apache RAT passed on Java 17 with Flink 2.2. ```shell mvn -B -Dflink2.2 -pl hudi-client/hudi-client-common,hudi-client/hudi-flink-client -am -Punit-tests -Dtest=TestHoodieNativeLogFormatWriter,TestHoodieNativeLogAppendHandle,TestFileGroupReaderBasedNativeLogAppendHandle,TestFlinkNativeLogAppendHandle -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -DwildcardSuites=skipScalaTests test ``` `git diff --check` and the repository PR compliance validator also passed. The full test suite was not run. ### Impact The internal `HoodieNativeLogFormatWriter.appendRecord` and `appendDeleteRecord` methods now take the record and schema only; all repository callers are updated. No storage-format, public client API, or configuration changes. Valid keyed records retain the same serialized keys; unkeyed records are outside this writer's contract. No expected material performance impact. ### Risk Level low: the change relies on the existing append-path requirement that records carry a generated key. Both data and delete paths are covered, and append-handle tests exercise routing and rollover behavior. ### Documentation Update The writer class documentation now states that incoming records must carry their generated key, including when metadata fields are disabled. No website update is needed because there is no new user-facing feature or configuration. ### 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]
