Skip to content

REST: Apply the scan filter when the server omits the residual - #4379

Open
linzch3 wants to merge 1 commit into
apache:mainfrom
linzch3:codex/rest-scan-residual
Open

linzch3 wants to merge 1 commit into
apache:mainfrom
linzch3:codex/rest-scan-residual

Conversation

@linzch3

@linzch3 linzch3 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

When a REST server omits residual-filter from a file scan task, PyIceberg treats the task as unfiltered. For a Parquet file with x = [1, 2, 1], scan(row_filter="x != 1").count() returns 3 while to_arrow() returns 1.

Use the original scan filter as the fallback residual for both the initial plan and any fetched task batches, as required by the Iceberg REST specification. Explicit server residuals still take precedence.

This addresses the REST case reported in #4278.

Are these changes tested?

The regression uses a local Parquet file and exercises both the initial response and pagination. It fails on main and the current head of #4278, and passes with this change. The planning tests also verify that an explicit true residual is preserved and that an unfiltered request still gets an unfiltered task.

make test: 4,685 passed, 5 skipped. make lint passed.

Are there any user-facing changes?

Filtered counts now agree with Arrow scans when a server omits the residual. Affected files may be read to apply the filter.

AI assistance

An AI assistant helped trace the planning code and draft the tests; I reviewed and ran everything and take responsibility for the change.

Use the original request filter for file scan tasks without a server residual so count() applies the same filter as Arrow scans.

This branch has not been deployed

No deployments
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.

1 participant