feat: handle cross-batch schema evolution in ArrowToParquetWriter (#3…#3896
Open
AyushPatel101 wants to merge 2 commits intodlt-hub:develfrom
Open
feat: handle cross-batch schema evolution in ArrowToParquetWriter (#3…#3896AyushPatel101 wants to merge 2 commits intodlt-hub:develfrom
AyushPatel101 wants to merge 2 commits intodlt-hub:develfrom
Conversation
added 2 commits
April 27, 2026 11:52
…t-hub#3895) ParquetWriter locks schema on first write_table() call, rejecting subsequent batches with different types even when arrow_concat_promote_options is set to handle them. This extends type promotion to work across flush batch boundaries by casting narrower types up or rotating to a new file for wider types.
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.
Description
arrow_concat_promote_optionscurrently only handles type mismatches within a single flush batch (viapa.concat_tables). Butpyarrow.ParquetWriterlocks its schema on the firstwrite_table()call, so mismatches that span different flush batches crash withArrowInvalid- even for safe promotions likefloat32 -> float64.This makes correctness depend on data volume: a pipeline that works with 2000 rows per batch crashes with 6000 rows when batches land in separate flushes.
This PR extends
ArrowToParquetWriter.write_data()to reconcile schemas across flush batches usingpa.unify_schemas()with the samepromote_optionsvalue already used for within-batch concat:float32intofloat64writer): cast up to match. Lossless, same file.float64intofloat32writer): rotate to a new parquet file. Destinations already handle multiple files per table.promote_options="none"(default) is completely unchanged.Related Issues