Skip to content

Disable pushdown for arrow tables that contain view columns - #20703

Merged
pdet merged 2 commits into
duckdb:v1.5-variegatafrom
evertlammerts:arrow_view_pushdown_fix
Feb 3, 2026
Merged

pdet merged 2 commits into
duckdb:v1.5-variegatafrom
evertlammerts:arrow_view_pushdown_fix

Conversation

@evertlammerts

@evertlammerts evertlammerts commented Jan 27, 2026 •

Copy link
Copy Markdown
Member

This is an attempt at a workaround / fix for duckdb/duckdb-python#227.

Problem

Pyarrow's array_filter kernel throws NotImplemented when it's applied on a schema that has a view type, even if the filter itself is on a different type. Since we evaluate whether we can pushdown a filter based on the type of the column we filter on (supports_pushdown_type), we might still pushdown filters that fail during the scan.

Note: this is an issue for binary and string views. List views do not seem to have this problem.

Approach

We refuse to push down filters if the table contains a view type. This is a coarse solution, but for now it solves the problem and given that Arrow's own compute kernels refuse to filter tables with views, it's not unreasonable.

Alternatives

  • Gating pushdown with a config option. We could add a config option (arrow_filter_pushdown_with_view_types, default = false) that gates pushdown on schemas that includes a view type. By default, it checks whether ArrowScanFunctionData::arrow_table contains columns with view typers, and if so, disables pushdown. Users can enable pushdown by setting arrow_filter_pushdown_with_view_types = true. We deiced against this because we already have arrow_output_list_view, produce_arrow_string_view and arrow_output_version that all play together in producing views. We should really clean that up.
  • Adding pushdown capabilities to the scanner. We could extend TableFunctionData with some notion of pushdown capabilities that can be checked by the table function when we decide whether we can pushdown a filter. This is a nicer option that allows more control per scanner, so that when we use e.g. pyarrow to push down we can set some conditions. It's also more invasive and relatively complex, so for now we don't do this.

@evertlammerts
evertlammerts requested a review from pdet January 27, 2026 21:05
@evertlammerts
evertlammerts marked this pull request as ready for review January 28, 2026 07:22
Comment thread src/function/table/arrow.cpp Resolved
@pdet

pdet commented Jan 28, 2026

Copy link
Copy Markdown
Member

The main issue I see is that we add yet another obscure option that does something extremely specific to our Arrow integration, and the problem of obscure options outside the default path, is that people will most likely never set them (not sure about the AI though, hehe) . It also surprises me a bit that these types still do not have their filter kernel in the main Arrow library, as they have been around for quite some time.

One thing we could consider doing is to have this information coded in our library integration instead. IIRC, for pyarrow we actually construct these filters in Python land. The same would be necessary for any other library we would integrate with, right? Can we signal to DuckDB, to not to push down certain types depending on which scanner we have (e.g., if pyarrow don't pushdown these types in core). Might be a bit more infrastructure work, but we avoid a new setting. If you think that would be too much work, I would personally prefer to just skip these view filters entirely, and then do what I described here whenever some library actually implements them.

@Tishj

Tishj commented Jan 28, 2026

Copy link
Copy Markdown
Member

Can't we just implement this logic in ArrowTableFunction::ArrowPushdownType ?
Yes it receives a col_idx, but we can still look at the other columns, if any of the columns are a string-view then return false, can even cache that info in the bind data, so we don't do this traversal for each referenced column

@evertlammerts

Copy link
Copy Markdown
Member Author

Can't we just implement this logic in ArrowTableFunction::ArrowPushdownType ? Yes it receives a col_idx, but we can still look at the other columns, if any of the columns are a string-view then return false, can even cache that info in the bind data, so we don't do this traversal for each referenced column

That is exactly where it is implemented in this PR, see https://github.com/duckdb/duckdb/pull/20703/changes#diff-ce1b80ec09a97c097d88eb9725ba4628316e107be28de8b3459cee69956c67a7L282

Discussed offline with @pdet: we won't add the option, when a table has a string or binary view we don't push down the filter. I'll update the PR now.

@duckdb-draftbot
duckdb-draftbot marked this pull request as draft January 29, 2026 09:54
@evertlammerts evertlammerts changed the title Add option to disable pushdown for arrow view columns Disable pushdown for arrow tables that contain view columns Jan 29, 2026
@evertlammerts
evertlammerts marked this pull request as ready for review January 29, 2026 09:56
@pdet

pdet commented Jan 30, 2026

Copy link
Copy Markdown
Member

LGTM, can you just merge with 1.5 again to see if CI passes?

@evertlammerts
evertlammerts force-pushed the arrow_view_pushdown_fix branch from 74392ea to 7d57546 Compare February 1, 2026 12:29
@duckdb-draftbot
duckdb-draftbot marked this pull request as draft February 1, 2026 12:30
@evertlammerts
evertlammerts marked this pull request as ready for review February 2, 2026 10:39
@evertlammerts

Copy link
Copy Markdown
Member Author

LGTM, can you just merge with 1.5 again to see if CI passes?

Rebased!

@pdet

pdet commented Feb 3, 2026

Copy link
Copy Markdown
Member

Thanks. Failure is unrelated!

@pdet
pdet merged commit 584c07d into duckdb:v1.5-variegata Feb 3, 2026
103 of 104 checks passed
@evertlammerts
evertlammerts deleted the arrow_view_pushdown_fix branch February 6, 2026 09:10
krlmlr added a commit to krlmlr/duckdb-r-old that referenced this pull request Feb 28, 2026
Date: 2026-02-03 07:57:02 -0300

Disable pushdown for arrow tables that contain view columns (duckdb/duckdb#20703)
remove outdated delta patch (duckdb/duckdb#20718)
Fix JSON file_extension option (duckdb/duckdb#20751)
Assign next batch index in union pipelines correctly (duckdb/duckdb#20785)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request Feb 28, 2026
Date: 2026-02-03 07:57:02 -0300

Disable pushdown for arrow tables that contain view columns (duckdb/duckdb#20703)
remove outdated delta patch (duckdb/duckdb#20718)
Fix JSON file_extension option (duckdb/duckdb#20751)
Assign next batch index in union pipelines correctly (duckdb/duckdb#20785)
krlmlr added a commit to krlmlr/duckdb-r-old that referenced this pull request Feb 28, 2026
Date: 2026-02-03 07:57:02 -0300

Disable pushdown for arrow tables that contain view columns (duckdb/duckdb#20703)
remove outdated delta patch (duckdb/duckdb#20718)
Fix JSON file_extension option (duckdb/duckdb#20751)
Assign next batch index in union pipelines correctly (duckdb/duckdb#20785)
krlmlr added a commit to krlmlr/duckdb-r-old that referenced this pull request Feb 28, 2026
Date: 2026-02-03 07:57:02 -0300

Disable pushdown for arrow tables that contain view columns (duckdb/duckdb#20703)
remove outdated delta patch (duckdb/duckdb#20718)
Fix JSON file_extension option (duckdb/duckdb#20751)
Assign next batch index in union pipelines correctly (duckdb/duckdb#20785)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants