[HUDI-9666] Auto-deduce ComplexKeyGenerator single-field record-key encoding on branch-0.x#19305
Open
ad1happy2go wants to merge 1 commit into
Open
[HUDI-9666] Auto-deduce ComplexKeyGenerator single-field record-key encoding on branch-0.x#19305ad1happy2go wants to merge 1 commit into
ad1happy2go wants to merge 1 commit into
Conversation
…ncoding on branch-0.x For a ComplexKeyGenerator with a single record-key field, the _hoodie_record_key encoding changed across releases (HUDI-7001): 0.14.0 and older wrote field:value, while 0.14.1/0.15.0 wrote the bare value. Mixing writers silently mixes both formats, so upserts stop matching existing records and create duplicates. The existing guard (apache#17834) fails all single-field complex-keygen writes by default until the user manually picks an encoding. This change makes the writer self-healing instead: - New config hoodie.write.complex.keygen.auto.deduce.encoding (default true): on write initialization, read one stored _hoodie_record_key from an existing base file, detect the table's actual encoding, and pin it on the write config. - The deduced value is cached in .hoodie/.aux/complex_key_encoding. - New/empty tables default to the new encoding instead of failing the first write. - The validation guard still applies when auto-deduction is disabled; readers are never affected. Adds three functional test suites covering auto-deduction of both encodings, the existing-table upgrade safe/danger paths, and new-table defaults. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ad1happy2go
force-pushed
the
complex-keygen-fix-branch-0x
branch
from
July 16, 2026 09:03
a83d686 to
aeb6e8c
Compare
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Logs
For a
ComplexKeyGeneratorwith a single record-key field, the_hoodie_record_keyencoding changed across releases (HUDI-7001): 0.14.0 and older wrotefield:value, while 0.14.1/0.15.0/1.0.0–1.0.2 wrote the barevalue. A table written by one release and then written by another silently mixes both formats, so upserts stop matching existing records and create duplicates.The current guard (#17834) fails all single-field complex-keygen writes by default until the user manually picks an encoding via
hoodie.write.complex.keygen.new.encoding. This PR makes the writer self-healing instead:hoodie.write.complex.keygen.auto.deduce.encoding, defaulttrue): on write initialization, read one stored_hoodie_record_keyfrom an existing base file, detect the table's actual encoding, and pin it on the write config so upserts keep matching..hoodie/.aux/complex_key_encoding; subsequent writes read the cache instead of the parquet footer.Impact
Single-field
ComplexKeyGeneratorwrites work out of the box across upgrades (no manual encoding config, no failed pipelines), while preserving the existing table's key format and preventing duplicate records.Risk level
medium
Verified by three new functional test suites (auto-deduction of both encodings, existing-table upgrade safe/danger paths, new-table defaults). Also validated end-to-end with bundle jars against tables created by genuine 0.14.0 (
field:value) and 0.14.1 (bare value) releases: encoding detected and preserved, 100/100 records upserted in place, zero duplicates.Documentation Update
Config docs for
hoodie.write.complex.keygen.new.encoding,hoodie.write.complex.keygen.auto.deduce.encoding, andhoodie.write.complex.keygen.validation.enableare updated inHoodieWriteConfig. The deployment-guide section on the complex key generator should be updated to mention auto-deduction as the default behavior.Contributor's checklist
🤖 Generated with Claude Code