This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 75538c8c5e doc: More comments to `concat_batches` (#10178)
75538c8c5e is described below
commit 75538c8c5e69d192a191c0dab4bf78ba148b6e98
Author: Yongting You <[email protected]>
AuthorDate: Mon Jun 22 23:06:59 2026 +0800
doc: More comments to `concat_batches` (#10178)
# 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 #NNN.
# Rationale for this change
<!--
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.
-->
This adds more documentation for `concat_batches()`. Both points have
caused bugs or inefficiencies in DataFusion, so I think they are worth
documenting, even if the `StringArray` offset issue is slightly outside
the scope of this function.
# What changes are included in this PR?
<!--
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?
<!--
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?
<!--
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.
-->
---
arrow-select/src/concat.rs | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arrow-select/src/concat.rs b/arrow-select/src/concat.rs
index bb85d7035a..88faf98872 100644
--- a/arrow-select/src/concat.rs
+++ b/arrow-select/src/concat.rs
@@ -593,6 +593,16 @@ fn concat_fallback(arrays: &[&dyn Array], capacity:
Capacities) -> Result<ArrayR
/// The output batch has the specified `schemas`; The schema of the
/// input are ignored.
///
+/// # Notes
+///
+/// - Callers should budget for peak memory use to approach 2x the input
+/// size, as the input batches and output arrays co-exist during
construction.
+/// - Arrays with `i32` offsets, such as `StringArray` and `BinaryArray`, only
+/// support up to ~2GiB of payloads. Concatenating large arrays of these
types
+/// can cause offset overflows.
+///
+/// # Errors
+///
/// Returns an error if the types of underlying arrays are different.
pub fn concat_batches<'a>(
schema: &SchemaRef,