Skip to content

Commit

Permalink
fix: Don't deep clone manuallydrop in GroupsPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jan 24, 2025
1 parent 88dd1e9 commit b0a6a9c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/polars-core/src/frame/group_by/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ impl<'a> ParallelIterator for GroupsTypeParIter<'a> {
}
}

#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct GroupPositions {
sliced: ManuallyDrop<GroupsType>,
// Unsliced buffer
Expand All @@ -591,6 +591,19 @@ pub struct GroupPositions {
len: usize,
}

impl Clone for GroupPositions {
fn clone(&self) -> Self {
let sliced = slice_groups_inner(&self.original, self.offset, self.len);

Self {
sliced,
original: self.original.clone(),
offset: self.offset,
len: self.len,
}
}
}

impl PartialEq for GroupPositions {
fn eq(&self, other: &Self) -> bool {
self.offset == other.offset && self.len == other.len && self.sliced == other.sliced
Expand Down

0 comments on commit b0a6a9c

Please sign in to comment.