Skip to content

[python] bind projected predicates to source columns for file pruning. - #11546

Open
fengruotj wants to merge 1 commit into
apache:masterfrom
fengruotj:fix/predicate-projection
Open

fengruotj wants to merge 1 commit into
apache:masterfrom
fengruotj:fix/predicate-projection

Conversation

@fengruotj

Copy link
Copy Markdown
Contributor

Fixes #11545.

PyPaimon can prune files that contain matching rows when a predicate is built after a named projection or with_read_type(). For example, projecting only name from [tag, name] moves name to index 0 in the read schema. The Python planner then uses that index to look up file statistics and compares the predicate against tag. This can silently drop matching files or raise a TypeError when the column types differ.

This PR records the source field path on projected top-level predicates so the planner uses the correct column statistics during file pruning.

Tests

Added a regression test with two Parquet files. It verifies that startswith("name", "pro-") and equal("name", "pro-1") each keep exactly one file and return pro-1. The test covers named projections, output aliases, and with_read_type(), with both string and integer tag columns.

All 77 tests across the four projection-related test files passed.

@Akash3121 Akash3121 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

[Bug] PyPaimon can prune matching files when predicates are built after a named projection

2 participants