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): match_chunks shouldn't change the dtype #13222

Merged
merged 1 commit into from
Dec 25, 2023

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Dec 23, 2023

This fixes #13194.

@github-actions github-actions bot added fix Bug fix rust Related to Rust Polars labels Dec 23, 2023
@@ -481,7 +481,8 @@ where
})
.collect();

unsafe { Self::from_chunks(self.name(), chunks) }
// SAFETY: We just slice the original chunks, their type will not change.
unsafe { Self::from_chunks_and_dtype(self.name(), chunks, self.dtype().clone()) }
Copy link
Collaborator Author

@reswqa reswqa Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type of chunked_array should not be changed here, the previous code would infer the final type from the type of chunks, but this is not good for our logical type. For example, a DatetimeChunked will degenerate into a UInt64Chunked after being matched_chunks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof.. Good catch.

@reswqa reswqa marked this pull request as ready for review December 24, 2023 13:32
@ritchie46 ritchie46 merged commit 4d33079 into pola-rs:main Dec 25, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering changes data types of list columns
2 participants