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

Implement PyArrowType for Box<dyn RecordBatchReader + Send> #4751

Merged
merged 2 commits into from
Sep 1, 2023

Conversation

wjones127
Copy link
Member

Which issue does this PR close?

Closes #4730.

I couldn't get it to work for a generic RBR, but it needs to be boxed anyways.

Rationale for this change

Saves the user the step of creating an ArrowArrayStreamReader when exporting a record batch reader.

What changes are included in this PR?

Are there any user-facing changes?

@wjones127 wjones127 marked this pull request as draft August 30, 2023 03:21
@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 30, 2023
@wjones127 wjones127 marked this pull request as ready for review August 30, 2023 03:57
@wjones127 wjones127 requested review from viirya and tustvold August 30, 2023 03:57
@@ -277,10 +278,19 @@ impl FromPyArrow for ArrowArrayStreamReader {
}
}

impl IntoPyArrow for ArrowArrayStreamReader {
impl FromPyArrow for Box<dyn RecordBatchReader + Send> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the advantage of this over just using ArrowArrayStreamReader directly?

As an aside we should probably document this method better, it isn't immediately clear it can be passed a pyarrow RecordBatchReader

Copy link
Member Author

Choose a reason for hiding this comment

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

TBH I wouldn't have implemented FromPyArrow if it weren't required by PyArrowType. But you need to implement both IntoPyArrow and FromPyArrow in order to get PyArrowType.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... Perhaps we can relax those constraints 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #4757 which I think would remove the need for this

@wjones127 wjones127 force-pushed the 4730-pyarrowtype-rbr branch from 8675826 to 656ac57 Compare August 31, 2023 23:35
@tustvold tustvold merged commit 4927c1e into apache:master Sep 1, 2023
@wjones127 wjones127 deleted the 4730-pyarrowtype-rbr branch September 5, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support IntoPyArrow for impl RecordBatchReader
2 participants