Skip to content

Commit

Permalink
less
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 committed Mar 26, 2024
1 parent 846ebe5 commit 839dcd4
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions vortex-dict/src/compute.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use std::sync::Arc;

use vortex::array::primitive::PrimitiveArray;
use vortex::array::varbin::VarBinArray;
use vortex::compute::flatten::{flatten, flatten_primitive, FlattenFn, FlattenedArray};
use vortex::compute::scalar_at::{scalar_at, ScalarAtFn};
use vortex::compute::take::take;
Expand Down Expand Up @@ -34,18 +30,8 @@ impl FlattenFn for DictArray {
let values = flatten(self.values())?;

match values {
FlattenedArray::Primitive(v) => take(&v, &codes).map(|r| {
FlattenedArray::Primitive(
Arc::try_unwrap(r.into_any().downcast::<PrimitiveArray>().unwrap())
.expect("Expected take on PrimitiveArray array to produce new array"),
)
}),
FlattenedArray::VarBin(vb) => take(&vb, &codes).map(|r| {
FlattenedArray::VarBin(
Arc::try_unwrap(r.into_any().downcast::<VarBinArray>().unwrap())
.expect("Expected take on VarBin array to produce new array"),
)
}),
FlattenedArray::Primitive(v) => flatten(&take(&v, &codes)?),
FlattenedArray::VarBin(vb) => flatten(&take(&vb, &codes)?),
_ => Err(VortexError::InvalidArgument(
"Only VarBin and Primitive values array are supported".into(),
)),
Expand Down

0 comments on commit 839dcd4

Please sign in to comment.