Skip to content

[Python] Add Arrow materializers for table changes - #992

Merged
PatrickJin-db merged 10 commits into
delta-io:mainfrom
zacdav-db:python-cdf-arrow-table-handles
Nov 9, 2026
Merged

PatrickJin-db merged 10 commits into
delta-io:mainfrom
zacdav-db:python-cdf-arrow-table-handles

Conversation

@zacdav-db

@zacdav-db zacdav-db commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds Arrow-native materialization for table changes through:

  • TableChanges.to_arrow()
  • TableChanges.to_record_batches()
  • TableChanges.to_record_batch_reader()
  • load_table_changes_as_arrow(...)

Both parquet and delta-kernel CDF paths are supported.

Implementation

  • shares delta-kernel CDF scan setup and statistics logging with the existing pandas path
  • materializes CDF metadata columns with their Arrow schema types and derives insert/delete change types from their actions
  • preserves logical Delta schema names and column order across Arrow batches
  • keeps _add_special_cdf_schema output behavior while avoiding input mutation
  • removes the Delta capability header before returning lazy kernel batches
  • releases temporary snapshot and CDF scan resources when Arrow readers are closed, including before consumption, and keeps empty CDF batch iterators closeable
  • preserves versionless view CDF scans and physical schemas introduced in Support CDF on views in the python client #1006 across pandas and Arrow
  • compares Arrow and pandas results across existing CDF scenarios, including partitions, batch conversion, empty results, schema evolution, and 48 view CDF cases

Testing

  • Local Python test suite (Python 3.11, PyArrow 23.0.1): 186 passed, 131 skipped; integration tests skipped
  • Black, pycodestyle, selected Flake8 checks, and mypy: passed
  • pydoc checks skipped because sphinx-build is not installed
  • git diff --check: passed

Part of #860; follows the snapshot Arrow materializers merged in #949.

Zac Davies added 4 commits July 29, 2026 22:39
Signed-off-by: Zac Davies <zachary.davies+data@databricks.com>
Signed-off-by: Zac Davies <zachary.davies+data@databricks.com>
Signed-off-by: Zac Davies <zachary.davies+data@databricks.com>
Signed-off-by: Zac Davies <zachary.davies+data@databricks.com>
@zacdav-db
zacdav-db force-pushed the python-cdf-arrow-table-handles branch from c4cceeb to d9f6df6 Compare July 29, 2026 12:42
@zacdav-db
zacdav-db marked this pull request as ready for review August 7, 2026 09:32
Comment thread python/delta_sharing/reader.py Resolved
Comment thread python/delta_sharing/reader.py Resolved
@PatrickJin-db

Copy link
Copy Markdown
Collaborator

also FYI you might encounter merge conflicts with #1006

@zacdav-db

Copy link
Copy Markdown
Contributor Author

also FYI you might encounter merge conflicts with #1006

Yep, I've done a review and will leave a comment on that PR to see if can make that seamless.

PatrickJin-db
PatrickJin-db previously approved these changes Nov 5, 2026
Share versionless CDF scans between pandas and Arrow, preserve the physical Parquet view schema, and extend the existing view tests to Arrow tables and readers.
Comment thread python/delta_sharing/reader.py Resolved
Derive insert and delete from non-CDC actions before reading physical columns. Use pa.repeat for the constant Arrow column and extend the existing parity test to cover null and conflicting file values.
@zacdav-db

Copy link
Copy Markdown
Contributor Author

@PatrickJin-db the fix is pushed in 2677806. Could you take another look when you have a chance? Thanks.

@PatrickJin-db
PatrickJin-db merged commit 533e262 into delta-io:main Nov 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants