[HUDI-2763] Metadata table records - support for key deduplication and virtual keys #4447
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.
What is the purpose of the pull request
The backing log format for the metadata table is HFile, a KeyValue type.
Since the key field in the metadata record payload is a duplicate of the
Key in the Cell, the redundant key field in the record can be emptied
to save on the cost.
HoodieHFileWriter and HoodieHFileDataBlock will now serialize records
with the key field emptied by default. HFile writer level relies on the
callers to tell about the key field in the schema.
HoodieHFileReader when reading the serialized records back from disk,
it materializes the missing keyFields if any. It relies on the callers
to tell about the key field in the record schema.
WriteHandles and all its derived classes rely on the table properties
for the key field when constructing the file and log readers. This way
base file creation, append and merging all work seamlessly irrespective
of data or metadata table.
NOTE: There is a simplified version of this PR at #4449
where the HFile reader and writer would do key deduplication and key materialization only if
the record has the metadata payload schema field 'key' (the hardcoded version).
Verify this pull request
Tests have been added to verify the default virtual keys and key
deduplication support for the metadata table records.
Manually verified the serialized records on the disk are trimmed
off the key field
Committer checklist
Has a corresponding JIRA in PR title & commit
Commit message is descriptive of the change
CI is green
Necessary doc changes done or have another open PR
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.