Add equality-delete apply on PyArrow reads - #3805
Open
daviddallakyan2005 wants to merge 1 commit into
Open
Conversation
Index equality delete files and apply them on scan so CDC and merge-on-read tables can be read. Equality deletes still cannot be written. Closes apache#3270. Co-authored-by: Alex Stephen <alexstephen@google.com>
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.
Closes #3270
Rationale for this change
Index equality delete files and apply them on PyArrow scans so CDC and merge-on-read tables can be read. Equality deletes still cannot be written.
This ports the DeleteFileIndex work from #3285 onto current main, skips bounds prune when an equality field has been dropped, and left anti joins matching equality delete rows after positional deletes. It supersedes #3285, which is open and conflicting. Credit to Alex Stephen for the index. Please close #3285 if this path is preferred.
When a data file has equality deletes, the scan concatenates that file’s record batches, aligns each matching equality-delete table by field id then concats, adds is_null / fill_null (and is_nan for floats) helper columns per key, left anti joins once, then yields the survivors; files with only position deletes still yield each scanner batch.
Are these changes tested?
Yes.
make test3962 passed, 3 skipped, 1570 deselected
make lintAll prek hooks Passed
make test PYTEST_ARGS="-v -k equality"168 passed, 5367 deselected
uv run python -m pytest tests/table/test_delete_file_index.py tests/io/test_pyarrow.py tests/catalog/test_scan_planning_models.py tests/table/test_validate.py tests/table/test_init.py -m "(unmarked or parametrize) and not integration" -v371 passed, 57 deselected
make test-integration PYTEST_ARGS="-v --tb=short"1350 passed, 71 skipped, 3 failed, 4111 deselected
The three integration failures match main without this diff.
test_read_spark_written_puffin_dvraises DeprecationWarning forpuffin.to_vector(). Two DuckDB tests failed to download the iceberg extension.Are there any user-facing changes?
Yes. Tables that already store equality deletes can be scanned.