Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 105d147

Browse files
authoredApr 11, 2025··
fix: Incorrect length BinaryArray/ListBuilder (#22227)
1 parent 6508454 commit 105d147

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed
 

Diff for: ‎crates/polars-arrow/src/array/binary/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<O: Offset> StaticArrayBuilder for BinaryArrayBuilder<O> {
5353
}
5454

5555
fn len(&self) -> usize {
56-
self.offsets.len()
56+
self.offsets.len_proxy()
5757
}
5858

5959
fn extend_nulls(&mut self, length: usize) {

Diff for: ‎crates/polars-arrow/src/array/list/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<O: Offset, B: ArrayBuilder> StaticArrayBuilder for ListArrayBuilder<O, B> {
5252
}
5353

5454
fn len(&self) -> usize {
55-
self.offsets.len()
55+
self.offsets.len_proxy()
5656
}
5757

5858
fn extend_nulls(&mut self, length: usize) {

Diff for: ‎crates/polars-arrow/src/array/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,9 @@ pub mod iterator;
680680
mod binview;
681681
mod values;
682682

683-
pub use binary::{BinaryArray, BinaryValueIter, MutableBinaryArray, MutableBinaryValuesArray};
683+
pub use binary::{
684+
BinaryArray, BinaryArrayBuilder, BinaryValueIter, MutableBinaryArray, MutableBinaryValuesArray,
685+
};
684686
pub use binview::{
685687
BinaryViewArray, BinaryViewArrayGeneric, BinaryViewArrayGenericBuilder, MutableBinaryViewArray,
686688
MutablePlBinary, MutablePlString, Utf8ViewArray, View, ViewType,

Diff for: ‎crates/polars-arrow/src/offset.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,6 @@ impl<O: Offset> Offsets<O> {
211211
self.0.len() - 1
212212
}
213213

214-
#[inline]
215-
/// Returns the number of offsets in this container.
216-
pub fn len(&self) -> usize {
217-
self.0.len()
218-
}
219-
220214
/// Returns the byte slice stored in this buffer
221215
#[inline]
222216
pub fn as_slice(&self) -> &[O] {
@@ -241,7 +235,7 @@ impl<O: Offset> Offsets<O> {
241235
if additional == 1 {
242236
self.0.push(offset)
243237
} else {
244-
self.0.resize(self.len() + additional, offset)
238+
self.0.resize(self.0.len() + additional, offset)
245239
}
246240
}
247241

0 commit comments

Comments
 (0)
Please sign in to comment.