Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rust, python): fix generic streaming groupby on logical types #5752

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion polars/polars-core/src/frame/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ impl<'a> AnyValueBuffer<'a> {
}
}

pub fn new(dtype: &DataType, capacity: usize) -> AnyValueBuffer<'_> {
pub fn new(dtype: &DataType, capacity: usize) -> AnyValueBuffer<'a> {
(dtype, capacity).into()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl GenericGroupbySink {
.output_schema
.iter_dtypes()
.take(n_keys)
.map(|dtype| AnyValueBuffer::new(dtype, agg_map.len()))
.map(|dtype| AnyValueBuffer::new(&dtype.to_physical(), agg_map.len()))
.collect::<Vec<_>>();
let dtypes = agg_fns
.iter()
Expand Down Expand Up @@ -251,15 +251,17 @@ impl Sink for GenericGroupbySink {
let current_key_values = unsafe { self.keys.get_unchecked_release_mut(partition) };

let entry = current_partition.raw_entry_mut().from_hash(h, |key| {
let idx = key.idx as usize;
if self.keys_series.len() > 1 {
current_tuple.iter().enumerate().all(|(i, key)| unsafe {
current_key_values.get_unchecked_release(i + idx) == key
})
} else {
unsafe {
current_key_values.get_unchecked_release(idx)
== current_tuple.get_unchecked_release(0)
key.hash == h && {
let idx = key.idx as usize;
if self.keys_series.len() > 1 {
current_tuple.iter().enumerate().all(|(i, key)| unsafe {
current_key_values.get_unchecked_release(i + idx) == key
})
} else {
unsafe {
current_key_values.get_unchecked_release(idx)
== current_tuple.get_unchecked_release(0)
}
}
}
});
Expand Down