Repository navigation
AddFiles: Wire a destination-table key through the registration chain - #40817
Conversation
cea3aea to
782c0c4
Compare
|
R: @ahmedabu98 |
There was a problem hiding this comment.
📋 Review Summary
This PR cleanly threads a destination-table key (String) through the AddFiles registration pipeline (ReadFooterSchema, ConvertToDataFile, CreateManifests, and CommitManifestFilesDoFn) in preparation for dynamic table destinations. The refactoring preserves existing single-table behavior by attaching a constant table key via WithKeys and dropping it before the global schema combination step.
🔍 General Feedback
- Thread-safety in
ConvertToDataFileis well-maintained by transitioning the single-table state fields into a per-tableTableStateobject managed in aConcurrentMap, with synchronization and refresh flags scoped per table. - Coders and key types are properly configured across all modified
PCollectionstages and unit test helpers.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
ahmedabu98
left a comment
There was a problem hiding this comment.
LGTM, just a couple suggestions
| } | ||
|
|
||
| PCollection<KV<Integer, SerializableDataFile>> keyedFiles = | ||
| PCollection<KV<KV<String, Integer>, SerializableDataFile>> keyedFiles = |
There was a problem hiding this comment.
This breaks update and upgrade compatibility right?
I think it might be unavoidable, but please mention it in CHANGES.md
There was a problem hiding this comment.
nit: for this and below, can we use an Autovalue/Row type (containing destination and specID) instead of KV<String, Integer>?
Will make it more readable and also give us flexibility to add more columns in the future without breaking update compatibility
There was a problem hiding this comment.
Sure will mention in CHANGES.md, but I don't think breaking update compat is a big deal for AddFiles. It is a temporary migration transform that is highly unlikely to be updated in place.
There was a problem hiding this comment.
We're turning it into a Managed transform (#40827) so will also need to be wary of upgrade incompatible changes (e.g. a graph change from 2.77 to upgraded 2.79)
The current multi-table changes should be fine though, since Managed transform will come in 2.78 too
Threads a destination-table key through the
AddFilesregistration chain, holding the keyconstant at the configured table.
ReadFooterSchemaDoFn<String, SchemaGroup>DoFn<KV<String,String>, KV<String,SchemaGroup>>ConvertToDataFileDoFn<String, SerializableDataFile>DoFn<KV<String,String>, KV<String,SerializableDataFile>>CreateManifestsspecIdKV<table, specId>CommitManifestFilesDoFnidentifierfieldbatch.getKey()AddFiles.expandsupplies the constant withWithKeys.<String,String>of(tableIdentifier), anddistinctSchemasdrops the key again soits global combine and the commit path downstream are untouched.
Reviewable as six steps, in this order:
fileSchemashelperConcurrentMap<String, TableState>, name still constantidentifierand its constructor parameters are deletedKV<table, specId>