This is an automated email from the ASF dual-hosted git repository.
Jefffrey 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 8f00fb4b78 Fix interleave on zero-width FixedSizeListArray (#11026)
8f00fb4b78 is described below
commit 8f00fb4b785f912a91e90e760ec562f6533c5207
Author: Tim Poterba <[email protected]>
AuthorDate: Tue Sep 8 19:43:53 2026 -0400
Fix interleave on zero-width FixedSizeListArray (#11026)
Broke in #10046. Same fix as #10915
# 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 #11025.
# Rationale for this change
(see issue).
<!--
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?
<!--
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?
Yes.
<!--
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 fixes interleave semantics to the semantics in v58.3, which I
had before upgrading today.
<!--
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/interleave.rs | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/arrow-select/src/interleave.rs b/arrow-select/src/interleave.rs
index 2c476738c1..54f4412c5b 100644
--- a/arrow-select/src/interleave.rs
+++ b/arrow-select/src/interleave.rs
@@ -543,7 +543,13 @@ fn interleave_fixed_size_list(
}
};
- let array = FixedSizeListArray::new(field.clone(), size,
interleaved_values, interleaved.nulls);
+ let array = FixedSizeListArray::try_new_with_length(
+ field.clone(),
+ size,
+ interleaved_values,
+ interleaved.nulls,
+ indices.len(),
+ )?;
Ok(Arc::new(array))
}
@@ -2188,6 +2194,23 @@ mod tests {
assert_eq!(values.values(), &[5, 6, 7, 8, 1, 2, 9, 10, 3, 4]);
}
+ #[test]
+ fn test_interleave_zero_sized_fixed_size_list() {
+ let input = FixedSizeListArray::try_new_with_length(
+ Field::new_list_field(DataType::Int32, true).into(),
+ 0,
+ Arc::new(Int32Array::new_null(0)),
+ None,
+ 3,
+ )
+ .unwrap();
+
+ let indices = [(0, 2), (0, 0)];
+ let result = interleave(&[&input], &indices).unwrap();
+
+ assert_eq!(result.len(), 2);
+ }
+
#[test]
fn test_interleave_fixed_size_list_with_nulls() {
let field = Arc::new(Field::new("item", DataType::Int32, true));