Skip to content

minor : batches_to_flight_data() should not require ownership of arguments - #11010

Merged
alamb merged 4 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/allow-vector-re-use
Sep 10, 2026
Merged

alamb merged 4 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/allow-vector-re-use

Conversation

@Rich-T-kid

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

see #4014

What changes are included in this PR?

change arguments of batches_to_flight_data() to take in an iterator so that the underlying container (typically a vecotr) does not need to take ownership.

Are these changes tested?

n/a

Are there any user-facing changes?

yes, this is a breaking change. but it should be a no-op change for existing users that used Vec<record_batch>

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-flight arrow-flight crate labels Sep 7, 2026
Comment thread arrow-flight/src/utils.rs Outdated
pub fn batches_to_flight_data<'a>(
schema: &Schema,
batches: Vec<RecordBatch>,
batches: impl Iterator<Item = &'a RecordBatch>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we accept an impl IntoIterator instead? it makes it less breaking (i think a Vec qualifies for it) and i believe its a best practice

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good idea, makes the pr even smaller

@Jefffrey Jefffrey added the api-change Breaking API change, needs to wait for a major version release label Sep 8, 2026
@Rich-T-kid
Rich-T-kid force-pushed the rich-t-kid/allow-vector-re-use branch from d0f94b9 to 1da9fe0 Compare September 9, 2026 18:16

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @Rich-T-kid

Comment thread arrow-flight/src/utils.rs
pub fn batches_to_flight_data<'a>(
schema: &Schema,
batches: Vec<RecordBatch>,
batches: impl IntoIterator<Item = &'a RecordBatch>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To anyone else reading this -- the underlying buffers can be reused in the FlightData even if the RecordBatch itself is not. Thus this seems like a good change to me

@alamb
alamb merged commit a4963a9 into apache:main Sep 10, 2026
19 checks passed
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 18, 2026
…ments (apache#11010)

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#4014

# Rationale for this change
see  apache#4014

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?
change arguments of `batches_to_flight_data()` to take in an iterator so
that the underlying container (typically a vecotr) does not need to take
ownership.
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
n/a
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
yes, this is a breaking change. but it should be a no-op change for
existing users that used `Vec<record_batch>`
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->

---------

Co-authored-by: rich-T-kid <richardbaah@MacBook-Air-de-Richard.local>
Rich-T-kid added a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 21, 2026
…ments (apache#11010)

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#4014

# Rationale for this change
see  apache#4014

<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?
change arguments of `batches_to_flight_data()` to take in an iterator so
that the underlying container (typically a vecotr) does not need to take
ownership.
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?
n/a
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
yes, this is a breaking change. but it should be a no-op change for
existing users that used `Vec<record_batch>`
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->

---------

Co-authored-by: rich-T-kid <richardbaah@MacBook-Air-de-Richard.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Breaking API change, needs to wait for a major version release arrow Changes to the arrow crate arrow-flight arrow-flight crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

batches_to_flight_data() should not require ownership of arguments

3 participants