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

GH-43410: [Python] Support Arrow PyCapsule stream objects in write_dataset #43771

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Aug 20, 2024

Rationale for this change

Expanding the support internally in pyarrow where we accept objects implementing the Arrow PyCapsule interface. This PR adds support in ds.write_dataset() since we already accept a RecordBatchReader as well.

What changes are included in this PR?

ds.write_dataset() and ds.Scanner.from_baches() now accept any object implementing the Arrow PyCapsule interface for streams.

Are these changes tested?

Yes

Are there any user-facing changes?

No

Copy link

⚠️ GitHub issue #43410 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

base_dir = tempdir / 'inmemory_pycapsule'
stream = TableStreamWrapper(table)
ds.write_dataset(stream, base_dir,
basename_template='dat_{i}.arrow', format="feather")
Copy link
Member

Choose a reason for hiding this comment

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

Can we use ipc not feature for .arrow file?

Suggested change
basename_template='dat_{i}.arrow', format="feather")
basename_template='dat_{i}.arrow', format="ipc")

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Aug 20, 2024
@pitrou
Copy link
Member

pitrou commented Sep 18, 2024

@jorisvandenbossche Do you want to update this?

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