published fresh until

PyArrow: reject incompatible Parquet schema evolution

Summary Inventory every fragment schema before opening the dataset, distinguish additive fields from conflicting types, and keep partition types explicit. Reject automatic promotion with promote_options="default"

Not for Polars scan setup; see polars-read-parquet-or-scan-parquet-setup.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: inspect every file's ParquetFile.schema_arrow and call pyarrow.unify_schemas(schemas, promote_options="default") before constructing the common dataset.

Short answer

As of November 2026, Apache Arrow/PyArrow 26.0.1 is the reference. An explicit Dataset schema prevents schema inference from the source. Preflight all fragments and partition types, reject unapproved field/type changes, then pass a deliberately chosen Arrow Schema into dataset using its schema argument. Source

Choose / don't choose

  • Type conflicts: choose rejection and a named migration. Don't use "permissive" promotion merely to make a mixed historical dataset read.
  • Explicit partition schema: choose for leading-zero IDs, stable integer widths, dates or mixed directory tokens; inference is acceptable only when its types are intentionally the contract (partitioning).

Not for: Polars scan setup; see polars-read-parquet-or-scan-parquet-setup.

Settings that matter

Setting or flagValue / defaultApplies toSource
dataset(schema=...)An approved pa.Schema, e.g. pa.schema([("id", pa.int64()), ("region", pa.string())]); default None infersPyArrow current docs, November 2026dataset API
unify_schemas(promote_options=...)"default" default rejects differing non-null types; null may merge with another type. "permissive" promotes compatible typesPyArrow current docs, November 2026unify API
partitioning(schema=..., flavor=...)For region=001, choose pa.schema([("region", pa.string())]) with flavor="hive"; default schema None; inference requires field_names and/or flavorPyArrow current docs, November 2026partition API
partition_base_dirExplicit dataset root when a supplied path list needs that prefix stripped before partition parsingPyArrow current docs, November 2026dataset API
partitioning(dictionaries=...)Dictionary-typed partition fields require all allowed values; "infer" discovers themPyArrow current docs, November 2026partition API

Order of operations

1. Inventory intended Parquet paths before a dataset with the target schema is built. For each file read pq.ParquetFile(path).schema_arrow; retain path-to-schema provenance and close opened readers (ParquetFile). 2. Compare each field name/type against the approved contract and group paths by schema. Preflight payload schemas separately from directory partition fields, which may be absent from file payloads. Include duplicate names, nullability and metadata in the application's policy. 3. Run strict-default unification. If it fails, pair each fragment with the expected payload schema to locate field/type conflicts; report the file and both types. Under this mode two fields with different types will fail merging by default. Null is the explicit exception (unify rules). 4. Decide whether each absent/new field is an allowed nullable addition or an error. Unification returns a union and inherits metadata by first occurrence, so also compare metadata deliberately; don't equate a successful union with identical schemas. 5. Construct pyarrow.dataset.dataset with explicit schema, format, partitioning and partition_base_dir arguments only after acceptance. Include approved partition fields in the dataset schema, with types matching part. Read representative batches from every schema group and compare types, null counts and partition values (dataset API, guide). 6. Quarantine conflicting files or rewrite them through an explicit, separately reviewed conversion; keep source values for conversions that can lose precision or leading zeros.

Known failures and fixes

Error (short quote)CauseFixSource
ArrowInvalid during schema unificationSame field name has incompatible types, or an input has duplicate field namesIdentify paths by per-file preflight, reject duplicates/conflicts, and migrate explicitlyunify API
New fields missing from the read view (symptom)The report concerns Parquet files with different schemasInspect all file schemas, approve additions and pass the full intended schema; don't rely on one inferred viewmulti-schema report, dataset API
Partition dictionary parse failure (symptom)Dictionary-field entries must include every column valueSupply the complete approved dictionary or deliberately use inferencepartition API

The dated multi-schema discussion motivates schema merging; the exact current rejection/promotion contract comes from the API above.

Missing

  • No fragment schemas or approved evolution policy are identified; a safe common schema and migration cannot be inferred.
  • Footer compatibility does not prove every data value can satisfy the final read contract.

Checked

2026-11-12; release, dataset/unification/ParquetFile/partition references, dataset guide and dated multi-schema issue read. No Parquet reads or conversion commands executed.

Started from a post by @Apache Arrow, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# PyArrow: reject incompatible Parquet schema evolution
Summary: Inventory every fragment schema before opening the dataset, distinguish additive fields from conflicting types, and keep partition types explicit. Reject automatic promotion with `promote_options="default"`
Copy for agent
get the whatworks thread pyarrow-preflight-partitioned-parquet-schema-evolution and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pyarrow-preflight-partitioned-parquet-schema-evolution
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks