Skip to content

Commit 5e913ed

Browse files
authored
Merge branch 'develop' into operators-bench
2 parents 02da220 + fb976a1 commit 5e913ed

File tree

25 files changed

+238
-39
lines changed

25 files changed

+238
-39
lines changed

encodings/alp/src/alp/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl ALPArray {
432432
}
433433

434434
impl ValidityChild<ALPVTable> for ALPVTable {
435-
fn validity_child(array: &ALPArray) -> &dyn Array {
435+
fn validity_child(array: &ALPArray) -> &ArrayRef {
436436
array.encoded()
437437
}
438438
}

encodings/alp/src/alp_rd/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl ALPRDArray {
368368
}
369369

370370
impl ValidityChild<ALPRDVTable> for ALPRDVTable {
371-
fn validity_child(array: &ALPRDArray) -> &dyn Array {
371+
fn validity_child(array: &ALPRDArray) -> &ArrayRef {
372372
array.left_parts()
373373
}
374374
}

encodings/datetime-parts/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl BaseArrayVTable<DateTimePartsVTable> for DateTimePartsVTable {
288288
}
289289

290290
impl ValidityChild<DateTimePartsVTable> for DateTimePartsVTable {
291-
fn validity_child(array: &DateTimePartsArray) -> &dyn Array {
291+
fn validity_child(array: &DateTimePartsArray) -> &ArrayRef {
292292
array.days()
293293
}
294294
}

encodings/datetime-parts/src/compute/rules.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
use vortex_array::Array;
45
use vortex_array::ArrayRef;
56
use vortex_array::IntoArray;
67
use vortex_array::arrays::ConstantArray;
78
use vortex_array::arrays::ConstantVTable;
89
use vortex_array::arrays::FilterArray;
910
use vortex_array::arrays::FilterVTable;
1011
use vortex_array::matchers::Exact;
11-
use vortex_array::optimizer::ArrayOptimizer;
1212
use vortex_array::optimizer::rules::ArrayParentReduceRule;
1313
use vortex_array::optimizer::rules::ParentRuleSet;
1414
use vortex_error::VortexExpect;
@@ -38,19 +38,15 @@ impl ArrayParentReduceRule<DateTimePartsVTable> for DTPFilterPushDownRule {
3838
parent: &FilterArray,
3939
child_idx: usize,
4040
) -> VortexResult<Option<ArrayRef>> {
41-
if child_idx != 0 {
42-
return Ok(None);
43-
}
41+
debug_assert_eq!(child_idx, 0);
4442

4543
if !child.seconds().is::<ConstantVTable>() || !child.subseconds().is::<ConstantVTable>() {
4644
return Ok(None);
4745
}
4846

4947
DateTimePartsArray::try_new(
5048
child.dtype().clone(),
51-
FilterArray::new(child.days().clone(), parent.filter_mask().clone())
52-
.into_array()
53-
.optimize()?,
49+
child.days().clone().filter(parent.filter_mask().clone())?,
5450
ConstantArray::new(
5551
child.seconds().as_constant().vortex_expect("constant"),
5652
parent.filter_mask().true_count(),

encodings/decimal-byte-parts/src/decimal_byte_parts/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ impl OperationsVTable<DecimalBytePartsVTable> for DecimalBytePartsVTable {
269269
}
270270

271271
impl ValidityChild<DecimalBytePartsVTable> for DecimalBytePartsVTable {
272-
fn validity_child(array: &DecimalBytePartsArray) -> &dyn Array {
272+
fn validity_child(array: &DecimalBytePartsArray) -> &ArrayRef {
273273
// validity stored in 0th child
274-
array.msp.as_ref()
274+
&array.msp
275275
}
276276
}
277277

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use vortex_array::Array;
4+
use vortex_array::ArrayRef;
55
use vortex_array::vtable::ValidityChild;
66

77
use super::FoRVTable;
88
use crate::FoRArray;
99

1010
impl ValidityChild<FoRVTable> for FoRVTable {
11-
fn validity_child(array: &FoRArray) -> &dyn Array {
12-
array.encoded().as_ref()
11+
fn validity_child(array: &FoRArray) -> &ArrayRef {
12+
array.encoded()
1313
}
1414
}

encodings/fastlanes/src/rle/vtable/validity.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use vortex_array::Array;
54
use vortex_array::ArrayRef;
65
use vortex_array::vtable::ValidityChild;
76
use vortex_array::vtable::ValidityChildSliceHelper;
@@ -10,8 +9,8 @@ use super::RLEVTable;
109
use crate::RLEArray;
1110

1211
impl ValidityChild<RLEVTable> for RLEVTable {
13-
fn validity_child(array: &RLEArray) -> &dyn Array {
14-
array.indices().as_ref()
12+
fn validity_child(array: &RLEArray) -> &ArrayRef {
13+
array.indices()
1514
}
1615
}
1716

encodings/fsst/src/array.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ pub struct FSSTArray {
198198
symbols: Buffer<Symbol>,
199199
symbol_lengths: Buffer<u8>,
200200
codes: VarBinArray,
201+
/// NOTE(ngates): this === codes, but is stored as an ArrayRef so we can return &ArrayRef!
202+
codes_array: ArrayRef,
201203
/// Lengths of the original values before compression, can be compressed.
202204
uncompressed_lengths: ArrayRef,
203205
stats_set: ArrayStats,
@@ -283,12 +285,14 @@ impl FSSTArray {
283285
Compressor::rebuild_from(symbols2.as_slice(), symbol_lengths2.as_slice())
284286
})
285287
as Box<dyn Fn() -> Compressor + Send>));
288+
let codes_array = codes.to_array();
286289

287290
Self {
288291
dtype,
289292
symbols,
290293
symbol_lengths,
291294
codes,
295+
codes_array,
292296
uncompressed_lengths,
293297
stats_set: Default::default(),
294298
compressor,
@@ -329,8 +333,6 @@ impl FSSTArray {
329333

330334
/// Build a [`Decompressor`][fsst::Decompressor] that can be used to decompress values from
331335
/// this array.
332-
///
333-
/// This is private to the crate to avoid leaking `fsst-rs` types as part of the public API.
334336
pub fn decompressor(&self) -> Decompressor<'_> {
335337
Decompressor::new(self.symbols().as_slice(), self.symbol_lengths().as_slice())
336338
}
@@ -379,8 +381,8 @@ impl BaseArrayVTable<FSSTVTable> for FSSTVTable {
379381
}
380382

381383
impl ValidityChild<FSSTVTable> for FSSTVTable {
382-
fn validity_child(array: &FSSTArray) -> &dyn Array {
383-
array.codes().as_ref()
384+
fn validity_child(array: &FSSTArray) -> &ArrayRef {
385+
&array.codes_array
384386
}
385387
}
386388

encodings/runend/src/array.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use vortex_array::search_sorted::SearchSortedSide;
2121
use vortex_array::serde::ArrayChildren;
2222
use vortex_array::stats::ArrayStats;
2323
use vortex_array::stats::StatsSetRef;
24+
use vortex_array::validity::Validity;
2425
use vortex_array::vtable;
2526
use vortex_array::vtable::ArrayId;
2627
use vortex_array::vtable::ArrayVTable;
@@ -427,6 +428,22 @@ impl ValidityVTable<RunEndVTable> for RunEndVTable {
427428
array.values().all_invalid()
428429
}
429430

431+
fn validity(array: &RunEndArray) -> VortexResult<Validity> {
432+
Ok(match array.values().validity()? {
433+
Validity::NonNullable | Validity::AllValid => Validity::AllValid,
434+
Validity::AllInvalid => Validity::AllInvalid,
435+
Validity::Array(values_validity) => Validity::Array(unsafe {
436+
RunEndArray::new_unchecked(
437+
array.ends().clone(),
438+
values_validity,
439+
array.offset(),
440+
array.len(),
441+
)
442+
.into_array()
443+
}),
444+
})
445+
}
446+
430447
fn validity_mask(array: &RunEndArray) -> Mask {
431448
match array.values().validity_mask() {
432449
Mask::AllTrue(_) => Mask::AllTrue(array.len()),

encodings/sequence/src/array.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use vortex_array::arrays::PrimitiveArray;
1919
use vortex_array::serde::ArrayChildren;
2020
use vortex_array::stats::ArrayStats;
2121
use vortex_array::stats::StatsSetRef;
22+
use vortex_array::validity::Validity;
2223
use vortex_array::vtable;
2324
use vortex_array::vtable::ArrayId;
2425
use vortex_array::vtable::ArrayVTable;
@@ -413,6 +414,10 @@ impl ValidityVTable<SequenceVTable> for SequenceVTable {
413414
false
414415
}
415416

417+
fn validity(_array: &SequenceArray) -> VortexResult<Validity> {
418+
Ok(Validity::AllValid)
419+
}
420+
416421
fn validity_mask(array: &SequenceArray) -> Mask {
417422
Mask::AllTrue(array.len())
418423
}

0 commit comments

Comments
 (0)