Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into join-where-key-type-c…
Browse files Browse the repository at this point in the history
…oerce
  • Loading branch information
nameexhaustion committed Feb 5, 2025
2 parents 1453baa + e17f4b2 commit 861e903
Show file tree
Hide file tree
Showing 40 changed files with 790 additions and 177 deletions.
10 changes: 5 additions & 5 deletions crates/polars-arrow/src/array/list/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ impl<O: Offset> ListArray<O> {
let first_idx = *offsets.first();
let len = offsets.range().to_usize();

if first_idx.to_usize() == 0 && values.len() == len {
return self.clone();
}
let values = if values.len() == len {
values.clone()
} else {
values.sliced(first_idx.to_usize(), len)
};

let offsets = if first_idx.to_usize() == 0 {
offsets.clone()
Expand All @@ -147,8 +149,6 @@ impl<O: Offset> ListArray<O> {
unsafe { OffsetsBuffer::<O>::new_unchecked(v.into()) }
};

let values = values.sliced(first_idx.to_usize(), len);

let values = match values.dtype() {
ArrowDataType::List(_) => {
let inner: &ListArray<i32> = values.as_ref().as_any().downcast_ref().unwrap();
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-arrow/src/array/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ impl ValueSize for FixedSizeListArray {
}
}

impl ValueSize for Utf8Array<i64> {
impl<O: Offset> ValueSize for Utf8Array<O> {
fn get_values_size(&self) -> usize {
unsafe {
// SAFETY:
// invariant of the struct that offsets always has at least 2 members.
let start = *self.offsets().get_unchecked(0) as usize;
let end = *self.offsets().last() as usize;
let start = self.offsets().get_unchecked(0).to_usize();
let end = self.offsets().last().to_usize();
end - start
}
}
Expand Down
Loading

0 comments on commit 861e903

Please sign in to comment.