feat(avro): apply column default values when reading missing fields (3/4)#800
Draft
huan233usc wants to merge 1 commit into
Draft
feat(avro): apply column default values when reading missing fields (3/4)#800huan233usc wants to merge 1 commit into
huan233usc wants to merge 1 commit into
Conversation
…3/4) When a column is present in the read schema but missing from an Avro data file (written before the column existed), fill it with the column's v3 initial-default instead of null. Reuses the shared arrow/literal_util materializer (merged in apache#792) and adds AppendDefaultToBuilder for the row-by-row Avro decode paths, plus a kDefault projection branch in the Avro schema/data projection. Part 3 of the v3 column-default-values work (POC apache#731), built on the schema support in apache#746 and the Parquet read path in apache#792.
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.
What
Part 3 of 4 of Iceberg v3 column default-value support (POC #731), built on the
schema layer (#746) and the Parquet read path (#792).
When a column is present in the read (table) schema but absent from an Avro data
file — because the column was added after those rows were written — fill it with
the column's v3
initial-defaultinstead ofnull.Changes
arrow/literal_util: addAppendDefaultToBuilder, which appends aLiteralonce to an ArrowArrayBuilder(for the row-by-row Avro decodepaths). Like
MakeDefaultArray, it targets the storage type for an extensionbuilder (
arrow.uuid), sinceScalar::CastTohas no kernel for extensiontypes.
avro_schema_util.cc): when a field is missing from thefile and carries an
initial-default, project it asFieldProjection::Kind::kDefault, mirroring the generic / Parquet paths.avro_data_util.cc,avro_direct_decoder.cc): materializethe
kDefaultbranch viaAppendDefaultToBuilder.Tests
literal_util_test:AppendDefaultToBuilderappends a value and casts to thebuilder type.
avro_data_test:AppendDatumToBuilderfills missing required and optionaldefault fields.
avro_test: end-to-end — write an Avro file with an old schema, then read itthrough
ReaderFactoryRegistrywith an evolved schema carrying defaults(
ReadMissingFieldsWithDefaults).Stack
addColumn/updateColumnDefault(feat: support v3 column default values in UpdateSchema (3/4) #793)Draft while the earlier PRs in the stack settle.