Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Arrow] Support consuming an "arrow_array_stream" PyCapsule #13386

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

Tishj
Copy link
Contributor

@Tishj Tishj commented Aug 12, 2024

This PR implements #10716

This allows consuming arrow array streams from PyCapsules, which do not necessarily have to be created by pyarrow.

For regular arrow scans we use pyarrow to perform filter pushdown on the stream, constructing a scanner to do so.
When scanning from a PyCapsule we disable this so no interaction with pyarrow is required.

Copy link
Contributor

@pdet pdet left a comment

Choose a reason for hiding this comment

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

Hey @Tishj, thanks for picking up this improvement. It is looking good and I've added some minor comments.

table_function.function = make_uniq<FunctionExpression>("arrow_scan", std::move(children));
if (type == PyArrowObjectType::PyCapsule) {
// Disable projection+filter pushdown
table_function.function = make_uniq<FunctionExpression>("arrow_scan_dumb", std::move(children));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe arrow_no_pushdown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"arrow_scan_dumb" already exists, I believe we can enable projection pushdown, but I didn't want to add the overhead of testing that, that sounds more like a future optimization if this functionality becomes popular/used a lot

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I've seen it, it still is not a great name name since it conveys very little of the difference between a regular arrow_scan and a "dumb" one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I agree, but it's used by duckdb-java, see the initial PR and the JDBC Client source code

I'm hesitant to rename something that's used by third party clients

@duckdb-draftbot duckdb-draftbot marked this pull request as draft August 12, 2024 12:42
@Tishj Tishj marked this pull request as ready for review August 12, 2024 14:56
Copy link
Contributor

@pdet pdet left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mytherin Mytherin merged commit 1f826fd into duckdb:main Aug 13, 2024
17 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Aug 13, 2024
Merge pull request duckdb/duckdb#13383 from Tmonster/fix_vector_sizes_nightly_failure
Merge pull request duckdb/duckdb#13386 from Tishj/pycapsule_test
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.

3 participants