Skip to content

Commit 8fd6271

Browse files
committed
extract
Signed-off-by: Andrew Duffy <[email protected]>
1 parent 6e55318 commit 8fd6271

File tree

1 file changed

+12
-32
lines changed
  • vortex-array/src/arrays/varbin/compute

1 file changed

+12
-32
lines changed

vortex-array/src/arrays/varbin/compute/take.rs

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,92 +17,72 @@ impl TakeKernel for VarBinVTable {
1717
let offsets = array.offsets().to_primitive();
1818
let data = array.bytes();
1919
let indices = indices.to_primitive();
20+
let dtype = array
21+
.dtype()
22+
.clone()
23+
.union_nullability(indices.dtype().nullability());
2024
let array = match_each_integer_ptype!(indices.ptype(), |I| {
2125
// On take, offsets get widened to either 32- or 64-bit based on the original type,
2226
// to avoid overflow issues.
2327
match offsets.ptype() {
2428
PType::U8 => take::<I, u8, u32>(
25-
array
26-
.dtype()
27-
.clone()
28-
.union_nullability(indices.dtype().nullability()),
29+
dtype,
2930
offsets.as_slice::<u8>(),
3031
data.as_slice(),
3132
indices.as_slice::<I>(),
3233
array.validity_mask(),
3334
indices.validity_mask(),
3435
),
3536
PType::U16 => take::<I, u16, u32>(
36-
array
37-
.dtype()
38-
.clone()
39-
.union_nullability(indices.dtype().nullability()),
37+
dtype,
4038
offsets.as_slice::<u16>(),
4139
data.as_slice(),
4240
indices.as_slice::<I>(),
4341
array.validity_mask(),
4442
indices.validity_mask(),
4543
),
4644
PType::U32 => take::<I, u32, u32>(
47-
array
48-
.dtype()
49-
.clone()
50-
.union_nullability(indices.dtype().nullability()),
45+
dtype,
5146
offsets.as_slice::<u32>(),
5247
data.as_slice(),
5348
indices.as_slice::<I>(),
5449
array.validity_mask(),
5550
indices.validity_mask(),
5651
),
5752
PType::U64 => take::<I, u64, u64>(
58-
array
59-
.dtype()
60-
.clone()
61-
.union_nullability(indices.dtype().nullability()),
53+
dtype,
6254
offsets.as_slice::<u64>(),
6355
data.as_slice(),
6456
indices.as_slice::<I>(),
6557
array.validity_mask(),
6658
indices.validity_mask(),
6759
),
6860
PType::I8 => take::<I, i8, i32>(
69-
array
70-
.dtype()
71-
.clone()
72-
.union_nullability(indices.dtype().nullability()),
61+
dtype,
7362
offsets.as_slice::<i8>(),
7463
data.as_slice(),
7564
indices.as_slice::<I>(),
7665
array.validity_mask(),
7766
indices.validity_mask(),
7867
),
7968
PType::I16 => take::<I, i16, i32>(
80-
array
81-
.dtype()
82-
.clone()
83-
.union_nullability(indices.dtype().nullability()),
69+
dtype,
8470
offsets.as_slice::<i16>(),
8571
data.as_slice(),
8672
indices.as_slice::<I>(),
8773
array.validity_mask(),
8874
indices.validity_mask(),
8975
),
9076
PType::I32 => take::<I, i32, i32>(
91-
array
92-
.dtype()
93-
.clone()
94-
.union_nullability(indices.dtype().nullability()),
77+
dtype,
9578
offsets.as_slice::<i32>(),
9679
data.as_slice(),
9780
indices.as_slice::<I>(),
9881
array.validity_mask(),
9982
indices.validity_mask(),
10083
),
10184
PType::I64 => take::<I, i64, i64>(
102-
array
103-
.dtype()
104-
.clone()
105-
.union_nullability(indices.dtype().nullability()),
85+
dtype,
10686
offsets.as_slice::<i64>(),
10787
data.as_slice(),
10888
indices.as_slice::<I>(),

0 commit comments

Comments
 (0)