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

feat: specialized IntoCanonical for DictArray utf8/binary #1146

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions encodings/dict/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,18 @@ impl ArrayTrait for DictArray {}

impl IntoCanonical for DictArray {
fn into_canonical(self) -> VortexResult<Canonical> {
let canonical_values: Array = self.values().into_canonical()?.into();
take(canonical_values, self.codes())?.into_canonical()
match self.dtype() {
// NOTE: Utf8 and Binary will decompress into VarBinViewArray, which requires a full
// decompression to construct the views child array.
// For this case, it is *always* faster to decompress the values first and then create
// copies of the view pointers.
DType::Utf8(_) | DType::Binary(_) => {
let canonical_values: Array = self.values().into_canonical()?.into();
take(canonical_values, self.codes())?.into_canonical()
}
// Non-string case: take and then canonicalize
_ => take(self.values(), self.codes())?.into_canonical(),
}
}
}

Expand Down
Loading