Skip to content

Commit efef4fc

Browse files
committed
fmt
Signed-off-by: Robert Kruszewski <github@robertk.io>
1 parent abc6902 commit efef4fc

13 files changed

Lines changed: 39 additions & 55 deletions

File tree

encodings/alp/src/alp_rd/compute/cast.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
use vortex_array::ArrayRef;
55
use vortex_array::ArrayView;
66
use vortex_array::IntoArray;
7-
use vortex_array::LEGACY_SESSION;
8-
use vortex_array::VortexSessionExecute;
97
use vortex_array::builtins::ArrayBuiltins;
108
use vortex_array::dtype::DType;
119
use vortex_array::scalar_fn::fns::cast::CastReduce;

encodings/fsst/src/array.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,11 @@ impl FSST {
409409
Array::from_parts_unchecked(ArrayParts::new(FSST, dtype, len, data).with_slots(slots))
410410
})
411411
}
412-
412+
413413
/// Legacy deserialization path (2 buffers): the codes were stored as a full
414414
/// `VarBinArray` child. We decompose the VarBinArray into its bytes (stored in
415415
/// FSSTData) and offsets/validity (stored in slots).
416+
#[allow(clippy::too_many_arguments)]
416417
fn deserialize_legacy(
417418
&self,
418419
dtype: &DType,

encodings/runend/src/array.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl RunEnd {
258258
length: usize,
259259
) -> RunEndArray {
260260
let dtype = values.dtype().clone();
261-
let slots = vec![Some(ends.clone()), Some(values.clone())];
261+
let slots = vec![Some(ends), Some(values)];
262262
let data = unsafe { RunEndData::new_unchecked(offset) };
263263
unsafe {
264264
Array::from_parts_unchecked(
@@ -510,22 +510,28 @@ pub(super) fn run_end_canonicalize(
510510

511511
#[cfg(test)]
512512
mod tests {
513+
use std::sync::LazyLock;
514+
513515
use vortex_array::IntoArray;
514-
use vortex_array::LEGACY_SESSION;
515516
use vortex_array::VortexSessionExecute;
516517
use vortex_array::arrays::DictArray;
517518
use vortex_array::arrays::VarBinViewArray;
518519
use vortex_array::assert_arrays_eq;
519520
use vortex_array::dtype::DType;
520521
use vortex_array::dtype::Nullability;
521522
use vortex_array::dtype::PType;
523+
use vortex_array::session::ArraySession;
522524
use vortex_buffer::buffer;
525+
use vortex_session::VortexSession;
523526

524527
use crate::RunEnd;
525528

529+
static SESSION: LazyLock<VortexSession> =
530+
LazyLock::new(|| VortexSession::empty().with::<ArraySession>());
531+
526532
#[test]
527533
fn test_runend_constructor() {
528-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
534+
let mut ctx = SESSION.create_execution_ctx();
529535
let arr = RunEnd::new(
530536
buffer![2u32, 5, 10].into_array(),
531537
buffer![1i32, 2, 3].into_array(),
@@ -546,7 +552,7 @@ mod tests {
546552

547553
#[test]
548554
fn test_runend_utf8() {
549-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
555+
let mut ctx = SESSION.create_execution_ctx();
550556
let values = VarBinViewArray::from_iter_str(["a", "b", "c"]).into_array();
551557
let arr = RunEnd::new(buffer![2u32, 5, 10].into_array(), values, &mut ctx);
552558
assert_eq!(arr.len(), 10);
@@ -560,7 +566,7 @@ mod tests {
560566

561567
#[test]
562568
fn test_runend_dict() {
563-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
569+
let mut ctx = SESSION.create_execution_ctx();
564570
let dict_values = VarBinViewArray::from_iter_str(["x", "y", "z"]).into_array();
565571
let dict_codes = buffer![0u32, 1, 2].into_array();
566572
let dict = DictArray::try_new(dict_codes, dict_values).unwrap();

encodings/runend/src/arrow.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use vortex_error::VortexResult;
2020

2121
use crate::RunEndData;
2222
use crate::ops::find_slice_end_index;
23+
2324
impl<R: RunEndIndexType> FromArrowArray<&RunArray<R>> for RunEndData
2425
where
2526
R::Native: NativePType,
@@ -147,7 +148,13 @@ mod tests {
147148
)
148149
};
149150

150-
RunEnd::try_new_offset_length(ends_slice, values_slice, offset, array.len())
151+
RunEnd::try_new_offset_length(
152+
ends_slice,
153+
values_slice,
154+
offset,
155+
array.len(),
156+
&mut SESSION.create_execution_ctx(),
157+
)
151158
}
152159

153160
#[test]

encodings/runend/src/compute/cast.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
use vortex_array::ArrayRef;
55
use vortex_array::ArrayView;
66
use vortex_array::IntoArray;
7-
use vortex_array::LEGACY_SESSION;
8-
use vortex_array::VortexSessionExecute;
97
use vortex_array::builtins::ArrayBuiltins;
108
use vortex_array::dtype::DType;
119
use vortex_array::scalar_fn::fns::cast::CastReduce;
@@ -18,8 +16,6 @@ impl CastReduce for RunEnd {
1816
// Cast the values array to the target type
1917
let casted_values = array.values().cast(dtype.clone())?;
2018

21-
// TODO(ctx): trait fixes - CastReduce::cast has a fixed signature.
22-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
2319
// SAFETY: casting does not affect the ends being valid
2420
unsafe {
2521
Ok(Some(
@@ -28,7 +24,6 @@ impl CastReduce for RunEnd {
2824
casted_values,
2925
array.offset(),
3026
array.len(),
31-
&mut ctx,
3227
)
3328
.into_array(),
3429
))
@@ -38,9 +33,10 @@ impl CastReduce for RunEnd {
3833

3934
#[cfg(test)]
4035
mod tests {
36+
use std::sync::LazyLock;
37+
4138
use rstest::rstest;
4239
use vortex_array::IntoArray;
43-
use vortex_array::LEGACY_SESSION;
4440
use vortex_array::VortexSessionExecute;
4541
use vortex_array::arrays::BoolArray;
4642
use vortex_array::arrays::PrimitiveArray;
@@ -50,14 +46,19 @@ mod tests {
5046
use vortex_array::dtype::DType;
5147
use vortex_array::dtype::Nullability;
5248
use vortex_array::dtype::PType;
49+
use vortex_array::session::ArraySession;
5350
use vortex_buffer::buffer;
51+
use vortex_session::VortexSession;
5452

5553
use crate::RunEnd;
5654
use crate::RunEndArray;
5755

56+
static SESSION: LazyLock<VortexSession> =
57+
LazyLock::new(|| VortexSession::empty().with::<ArraySession>());
58+
5859
#[test]
5960
fn test_cast_runend_i32_to_i64() {
60-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
61+
let mut ctx = SESSION.create_execution_ctx();
6162
let runend = RunEnd::try_new(
6263
buffer![3u64, 5, 8, 10].into_array(),
6364
buffer![100i32, 200, 100, 300].into_array(),
@@ -98,7 +99,7 @@ mod tests {
9899

99100
#[test]
100101
fn test_cast_runend_nullable() {
101-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
102+
let mut ctx = SESSION.create_execution_ctx();
102103
let runend = RunEnd::try_new(
103104
buffer![2u64, 4, 7].into_array(),
104105
PrimitiveArray::from_option_iter([Some(10i32), None, Some(20)]).into_array(),
@@ -118,7 +119,7 @@ mod tests {
118119

119120
#[test]
120121
fn test_cast_runend_with_offset() {
121-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
122+
let mut ctx = SESSION.create_execution_ctx();
122123
// Create a RunEndArray: [100, 100, 100, 200, 200, 300, 300, 300, 300, 300]
123124
let runend = RunEnd::try_new(
124125
buffer![3u64, 5, 10].into_array(),
@@ -174,7 +175,7 @@ mod tests {
174175
ctx,
175176
).unwrap())]
176177
fn test_cast_runend_conformance(#[case] build: RunEndBuilder) {
177-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
178+
let mut ctx = SESSION.create_execution_ctx();
178179
let array = build(&mut ctx);
179180
test_cast_conformance(&array.into_array());
180181
}

encodings/runend/src/compute/fill_null.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
use vortex_array::ArrayRef;
55
use vortex_array::ArrayView;
66
use vortex_array::IntoArray;
7-
use vortex_array::LEGACY_SESSION;
8-
use vortex_array::VortexSessionExecute;
97
use vortex_array::builtins::ArrayBuiltins;
108
use vortex_array::scalar::Scalar;
119
use vortex_array::scalar_fn::fns::fill_null::FillNullReduce;
@@ -20,8 +18,6 @@ impl FillNullReduce for RunEnd {
2018
fill_value: &Scalar,
2119
) -> VortexResult<Option<ArrayRef>> {
2220
let new_values = array.values().fill_null(fill_value.clone())?;
23-
// TODO(ctx): trait fixes - FillNullReduce::fill_null has a fixed signature.
24-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
2521
// SAFETY: modifying values only, does not affect ends
2622
Ok(Some(
2723
unsafe {
@@ -30,7 +26,6 @@ impl FillNullReduce for RunEnd {
3026
new_values,
3127
array.offset(),
3228
array.len(),
33-
&mut ctx,
3429
)
3530
}
3631
.into_array(),

encodings/runend/src/compute/filter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl FilterKernel for RunEnd {
6565
values,
6666
0,
6767
mask_values.true_count(),
68-
ctx,
6968
)
7069
.into_array(),
7170
))

encodings/runend/src/compute/take_from.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl ExecuteParentKernel<RunEnd> for RunEndTakeFrom {
2525
array: ArrayView<'_, RunEnd>,
2626
dict: ArrayView<'_, Dict>,
2727
child_idx: usize,
28-
ctx: &mut ExecutionCtx,
28+
_ctx: &mut ExecutionCtx,
2929
) -> VortexResult<Option<ArrayRef>> {
3030
if child_idx != 0 {
3131
return Ok(None);
@@ -44,10 +44,8 @@ impl ExecuteParentKernel<RunEnd> for RunEndTakeFrom {
4444
dict.values().take(array.values().clone())?,
4545
array.offset(),
4646
array.len(),
47-
ctx,
4847
)
4948
};
50-
//
5149
Ok(Some(ree_array.into_array()))
5250
}
5351
}
@@ -109,7 +107,6 @@ mod tests {
109107
codes.values().clone(),
110108
2, // offset
111109
3, // len
112-
&mut ctx,
113110
)
114111
};
115112

@@ -134,7 +131,6 @@ mod tests {
134131
codes.values().clone(),
135132
3, // offset at exact run boundary
136133
4, // len
137-
&mut ctx,
138134
)
139135
};
140136

@@ -159,7 +155,6 @@ mod tests {
159155
codes.values().slice(1..3)?,
160156
4, // offset
161157
1, // len
162-
&mut ctx,
163158
)
164159
};
165160

encodings/runend/src/kernel.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ fn slice(
7272
array.values().slice(slice_begin..slice_end)?,
7373
range.start + array.offset(),
7474
new_length,
75-
ctx,
7675
)
7776
.into_array()
7877
})

encodings/runend/src/rules.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
use vortex_array::ArrayRef;
55
use vortex_array::ArrayView;
66
use vortex_array::IntoArray;
7-
use vortex_array::LEGACY_SESSION;
8-
use vortex_array::VortexSessionExecute;
97
use vortex_array::arrays::Constant;
108
use vortex_array::arrays::ConstantArray;
119
use vortex_array::arrays::ScalarFnArray;
@@ -82,16 +80,13 @@ impl ArrayParentReduceRule<RunEnd> for RunEndScalarFnRule {
8280
ScalarFnArray::try_new(parent.scalar_fn().clone(), new_children, values_len)?
8381
.into_array();
8482

85-
// TODO(ctx): trait fixes - ArrayParentReduceRule::reduce_parent has a fixed signature.
86-
let mut ctx = LEGACY_SESSION.create_execution_ctx();
8783
Ok(Some(
8884
unsafe {
8985
RunEnd::new_unchecked(
9086
run_end.ends().clone(),
9187
new_values,
9288
run_end.offset(),
9389
run_end.len(),
94-
&mut ctx,
9590
)
9691
}
9792
.into_array(),

0 commit comments

Comments
 (0)