Skip to content

Commit a93ba5b

Browse files
committed
Remove unused scope
Signed-off-by: Nicholas Gates <[email protected]>
1 parent 7dde2f4 commit a93ba5b

File tree

21 files changed

+64
-271
lines changed

21 files changed

+64
-271
lines changed

encodings/fastlanes/benches/pipeline_bitpacking_compare_scalar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use vortex_array::{Array, ArrayRef, IntoArray, ToCanonical};
1313
use vortex_buffer::{BitBuffer, BufferMut};
1414
use vortex_dtype::NativePType;
1515
use vortex_error::VortexResult;
16-
use vortex_expr::{Scope, lit, lt, root};
16+
use vortex_expr::{lit, lt, root};
1717
use vortex_fastlanes::FoRArray;
1818
use vortex_fastlanes::bitpack_compress::bitpack_to_best_bit_width;
1919
use vortex_mask::Mask;
@@ -68,7 +68,7 @@ pub fn eval<T: NativePType + Into<Scalar>>(bencher: Bencher, fraction_kept: f64)
6868
.bench_local_values(|(mask, array)| {
6969
// We run the filter first, then compare.
7070
let array = filter(array.as_ref(), &mask).unwrap();
71-
expr.evaluate(&Scope::new(array)).unwrap().to_canonical()
71+
expr.evaluate(&array).unwrap().to_canonical()
7272
});
7373
}
7474

fuzz/fuzz_targets/file_io.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use vortex_array::{Array, Canonical, IntoArray, ToCanonical};
1212
use vortex_buffer::ByteBufferMut;
1313
use vortex_dtype::{DType, StructFields};
1414
use vortex_error::{VortexExpect, VortexUnwrap, vortex_panic};
15-
use vortex_expr::{Scope, lit, root};
15+
use vortex_expr::{lit, root};
1616
use vortex_file::{OpenOptionsSessionExt, WriteOptionsSessionExt, WriteStrategyBuilder};
1717
use vortex_fuzz::{CompressorStrategy, FuzzFileAction, RUNTIME, SESSION};
1818
use vortex_layout::layouts::compact::CompactCompressor;
@@ -36,14 +36,14 @@ fuzz_target!(|fuzz: FuzzFileAction| -> Corpus {
3636
let bool_mask = filter_expr
3737
.clone()
3838
.unwrap_or_else(|| lit(true))
39-
.evaluate(&Scope::new(array_data.clone()))
39+
.evaluate(&array_data)
4040
.vortex_unwrap();
4141
let mask = bool_mask.to_bool().to_mask_fill_null_false();
4242
let filtered = filter(&array_data, &mask).vortex_unwrap();
4343
projection_expr
4444
.clone()
4545
.unwrap_or_else(root)
46-
.evaluate(&Scope::new(filtered))
46+
.evaluate(&filtered)
4747
.vortex_unwrap()
4848
};
4949

vortex-expr/src/exprs/binary.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl ExpressionView<'_, Binary> {
264264
/// # use vortex_buffer::buffer;
265265
/// # use vortex_expr::{eq, root, lit, Scope};
266266
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
267-
/// let result = eq(root(), lit(3)).evaluate(&Scope::new(xs.to_array())).unwrap();
267+
/// let result = eq(root(), lit(3)).evaluate(&xs.to_array()).unwrap();
268268
///
269269
/// assert_eq!(
270270
/// result.to_bool().bit_buffer(),
@@ -288,7 +288,7 @@ pub fn eq(lhs: Expression, rhs: Expression) -> Expression {
288288
/// # use vortex_buffer::buffer;
289289
/// # use vortex_expr::{root, lit, not_eq, Scope};
290290
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
291-
/// let result = not_eq(root(), lit(3)).evaluate(&Scope::new(xs.to_array())).unwrap();
291+
/// let result = not_eq(root(), lit(3)).evaluate(&xs.to_array()).unwrap();
292292
///
293293
/// assert_eq!(
294294
/// result.to_bool().bit_buffer(),
@@ -312,7 +312,7 @@ pub fn not_eq(lhs: Expression, rhs: Expression) -> Expression {
312312
/// # use vortex_buffer::buffer;
313313
/// # use vortex_expr::{gt_eq, root, lit, Scope};
314314
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
315-
/// let result = gt_eq(root(), lit(3)).evaluate(&Scope::new(xs.to_array())).unwrap();
315+
/// let result = gt_eq(root(), lit(3)).evaluate(&xs.to_array()).unwrap();
316316
///
317317
/// assert_eq!(
318318
/// result.to_bool().bit_buffer(),
@@ -336,7 +336,7 @@ pub fn gt_eq(lhs: Expression, rhs: Expression) -> Expression {
336336
/// # use vortex_buffer::buffer;
337337
/// # use vortex_expr::{gt, root, lit, Scope};
338338
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
339-
/// let result = gt(root(), lit(2)).evaluate(&Scope::new(xs.to_array())).unwrap();
339+
/// let result = gt(root(), lit(2)).evaluate(&xs.to_array()).unwrap();
340340
///
341341
/// assert_eq!(
342342
/// result.to_bool().bit_buffer(),
@@ -360,7 +360,7 @@ pub fn gt(lhs: Expression, rhs: Expression) -> Expression {
360360
/// # use vortex_buffer::buffer;
361361
/// # use vortex_expr::{root, lit, lt_eq, Scope};
362362
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
363-
/// let result = lt_eq(root(), lit(2)).evaluate(&Scope::new(xs.to_array())).unwrap();
363+
/// let result = lt_eq(root(), lit(2)).evaluate(&xs.to_array()).unwrap();
364364
///
365365
/// assert_eq!(
366366
/// result.to_bool().bit_buffer(),
@@ -384,7 +384,7 @@ pub fn lt_eq(lhs: Expression, rhs: Expression) -> Expression {
384384
/// # use vortex_buffer::buffer;
385385
/// # use vortex_expr::{root, lit, lt, Scope};
386386
/// let xs = PrimitiveArray::new(buffer![1i32, 2i32, 3i32], Validity::NonNullable);
387-
/// let result = lt(root(), lit(3)).evaluate(&Scope::new(xs.to_array())).unwrap();
387+
/// let result = lt(root(), lit(3)).evaluate(&xs.to_array()).unwrap();
388388
///
389389
/// assert_eq!(
390390
/// result.to_bool().bit_buffer(),
@@ -406,7 +406,7 @@ pub fn lt(lhs: Expression, rhs: Expression) -> Expression {
406406
/// # use vortex_array::{IntoArray, ToCanonical};
407407
/// # use vortex_expr::{root, lit, or, Scope};
408408
/// let xs = BoolArray::from_iter(vec![true, false, true]);
409-
/// let result = or(root(), lit(false)).evaluate(&Scope::new(xs.to_array())).unwrap();
409+
/// let result = or(root(), lit(false)).evaluate(&xs.to_array()).unwrap();
410410
///
411411
/// assert_eq!(
412412
/// result.to_bool().bit_buffer(),
@@ -440,7 +440,7 @@ where
440440
/// # use vortex_array::{IntoArray, ToCanonical};
441441
/// # use vortex_expr::{and, root, lit, Scope};
442442
/// let xs = BoolArray::from_iter(vec![true, false, true]);
443-
/// let result = and(root(), lit(true)).evaluate(&Scope::new(xs.to_array())).unwrap();
443+
/// let result = and(root(), lit(true)).evaluate(&xs.to_array()).unwrap();
444444
///
445445
/// assert_eq!(
446446
/// result.to_bool().bit_buffer(),
@@ -486,7 +486,7 @@ where
486486
/// # use vortex_expr::{Scope, checked_add, lit, root};
487487
/// let xs = buffer![1, 2, 3].into_array();
488488
/// let result = checked_add(root(), lit(5))
489-
/// .evaluate(&Scope::new(xs.to_array()))
489+
/// .evaluate(&xs.to_array())
490490
/// .unwrap();
491491
///
492492
/// assert_eq!(

vortex-expr/src/exprs/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ mod tests {
140140
use super::cast;
141141
use crate::exprs::get_item::get_item;
142142
use crate::exprs::root::root;
143-
use crate::{Expression, Scope, test_harness};
143+
use crate::{Expression, test_harness};
144144

145145
#[test]
146146
fn dtype() {
@@ -172,7 +172,7 @@ mod tests {
172172
get_item("a", root()),
173173
DType::Primitive(PType::I64, Nullability::NonNullable),
174174
);
175-
let result = expr.evaluate(&Scope::new(test_array)).unwrap();
175+
let result = expr.evaluate(&test_array).unwrap();
176176

177177
assert_eq!(
178178
result.dtype(),

vortex-expr/src/exprs/get_item.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ mod tests {
160160
use vortex_scalar::Scalar;
161161

162162
use super::get_item;
163-
use crate::Scope;
164163
use crate::exprs::root::root;
165164

166165
fn test_array() -> StructArray {
@@ -175,15 +174,15 @@ mod tests {
175174
fn get_item_by_name() {
176175
let st = test_array();
177176
let get_item = get_item("a", root());
178-
let item = get_item.evaluate(&Scope::new(st.to_array())).unwrap();
177+
let item = get_item.evaluate(&st.to_array()).unwrap();
179178
assert_eq!(item.dtype(), &DType::from(I32))
180179
}
181180

182181
#[test]
183182
fn get_item_by_name_none() {
184183
let st = test_array();
185184
let get_item = get_item("c", root());
186-
assert!(get_item.evaluate(&Scope::new(st.to_array())).is_err());
185+
assert!(get_item.evaluate(&st.to_array()).is_err());
187186
}
188187

189188
#[test]
@@ -198,7 +197,7 @@ mod tests {
198197
.to_array();
199198

200199
let get_item = get_item("a", root());
201-
let item = get_item.evaluate(&Scope::new(st)).unwrap();
200+
let item = get_item.evaluate(&st).unwrap();
202201
assert_eq!(
203202
item.scalar_at(0),
204203
Scalar::null(DType::Primitive(I32, Nullability::Nullable))

vortex-expr/src/exprs/is_null.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod tests {
109109
use crate::exprs::literal::lit;
110110
use crate::exprs::root::root;
111111
use crate::pruning::checked_pruning_expr;
112-
use crate::{HashSet, Scope, test_harness};
112+
use crate::{HashSet, test_harness};
113113

114114
#[test]
115115
fn dtype() {
@@ -133,9 +133,7 @@ mod tests {
133133
.into_array();
134134
let expected = [false, true, false, true, false];
135135

136-
let result = is_null(root())
137-
.evaluate(&Scope::new(test_array.clone()))
138-
.unwrap();
136+
let result = is_null(root()).evaluate(&test_array.clone()).unwrap();
139137

140138
assert_eq!(result.len(), test_array.len());
141139
assert_eq!(result.dtype(), &DType::Bool(Nullability::NonNullable));
@@ -152,9 +150,7 @@ mod tests {
152150
fn evaluate_all_false() {
153151
let test_array = buffer![1, 2, 3, 4, 5].into_array();
154152

155-
let result = is_null(root())
156-
.evaluate(&Scope::new(test_array.clone()))
157-
.unwrap();
153+
let result = is_null(root()).evaluate(&test_array.clone()).unwrap();
158154

159155
assert_eq!(result.len(), test_array.len());
160156
assert_eq!(
@@ -169,9 +165,7 @@ mod tests {
169165
PrimitiveArray::from_option_iter(vec![None::<i32>, None, None, None, None])
170166
.into_array();
171167

172-
let result = is_null(root())
173-
.evaluate(&Scope::new(test_array.clone()))
174-
.unwrap();
168+
let result = is_null(root()).evaluate(&test_array.clone()).unwrap();
175169

176170
assert_eq!(result.len(), test_array.len());
177171
assert_eq!(
@@ -192,7 +186,7 @@ mod tests {
192186
let expected = [false, true, false, true, false];
193187

194188
let result = is_null(get_item("a", root()))
195-
.evaluate(&Scope::new(test_array.clone()))
189+
.evaluate(&test_array.clone())
196190
.unwrap();
197191

198192
assert_eq!(result.len(), test_array.len());

vortex-expr/src/exprs/like.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ mod tests {
143143
use vortex_array::arrays::BoolArray;
144144
use vortex_dtype::{DType, Nullability};
145145

146-
use crate::Scope;
147146
use crate::exprs::get_item::get_item;
148147
use crate::exprs::like::{like, not_ilike};
149148
use crate::exprs::literal::lit;
@@ -156,7 +155,7 @@ mod tests {
156155
let bools = BoolArray::from_iter([false, true, false, false, true, true]);
157156
assert_eq!(
158157
not_expr
159-
.evaluate(&Scope::new(bools.to_array()))
158+
.evaluate(&bools.to_array())
160159
.unwrap()
161160
.to_bool()
162161
.bit_buffer()

vortex-expr/src/exprs/list_contains.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ mod tests {
158158
use crate::exprs::literal::lit;
159159
use crate::exprs::root::root;
160160
use crate::pruning::checked_pruning_expr;
161-
use crate::{Arc, HashSet, Scope};
161+
use crate::{Arc, HashSet};
162162

163163
fn test_array() -> ArrayRef {
164164
ListArray::try_new(
@@ -175,7 +175,7 @@ mod tests {
175175
let arr = test_array();
176176

177177
let expr = list_contains(root(), lit(1));
178-
let item = expr.evaluate(&Scope::new(arr)).unwrap();
178+
let item = expr.evaluate(&arr).unwrap();
179179

180180
assert_eq!(item.scalar_at(0), Scalar::bool(true, Nullability::Nullable));
181181
assert_eq!(
@@ -189,7 +189,7 @@ mod tests {
189189
let arr = test_array();
190190

191191
let expr = list_contains(root(), lit(2));
192-
let item = expr.evaluate(&Scope::new(arr)).unwrap();
192+
let item = expr.evaluate(&arr).unwrap();
193193

194194
assert_eq!(item.scalar_at(0), Scalar::bool(true, Nullability::Nullable));
195195
assert_eq!(item.scalar_at(1), Scalar::bool(true, Nullability::Nullable));
@@ -200,7 +200,7 @@ mod tests {
200200
let arr = test_array();
201201

202202
let expr = list_contains(root(), lit(4));
203-
let item = expr.evaluate(&Scope::new(arr)).unwrap();
203+
let item = expr.evaluate(&arr).unwrap();
204204

205205
assert_eq!(
206206
item.scalar_at(0),
@@ -223,7 +223,7 @@ mod tests {
223223
.into_array();
224224

225225
let expr = list_contains(root(), lit(2));
226-
let item = expr.evaluate(&Scope::new(arr)).unwrap();
226+
let item = expr.evaluate(&arr).unwrap();
227227

228228
assert_eq!(item.scalar_at(0), Scalar::bool(true, Nullability::Nullable));
229229
assert_eq!(
@@ -243,7 +243,7 @@ mod tests {
243243
.into_array();
244244

245245
let expr = list_contains(root(), lit(2));
246-
let item = expr.evaluate(&Scope::new(arr)).unwrap();
246+
let item = expr.evaluate(&arr).unwrap();
247247

248248
assert_eq!(item.scalar_at(0), Scalar::bool(true, Nullability::Nullable));
249249
assert!(!item.is_valid(1));

vortex-expr/src/exprs/merge.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ mod tests {
195195
use vortex_error::{VortexResult, vortex_bail};
196196

197197
use super::merge;
198+
use crate::Expression;
198199
use crate::exprs::get_item::get_item;
199200
use crate::exprs::merge::{DuplicateHandling, merge_opts};
200201
use crate::exprs::root::root;
201-
use crate::{Expression, Scope};
202202

203203
fn primitive_field(array: &dyn Array, field_path: &[&str]) -> VortexResult<PrimitiveArray> {
204204
let mut field_path = field_path.iter();
@@ -256,7 +256,7 @@ mod tests {
256256
])
257257
.unwrap()
258258
.into_array();
259-
let actual_array = expr.evaluate(&Scope::new(test_array)).unwrap();
259+
let actual_array = expr.evaluate(&test_array).unwrap();
260260

261261
assert_eq!(
262262
actual_array.as_struct_typed().names(),
@@ -338,7 +338,7 @@ mod tests {
338338
.unwrap()
339339
.into_array();
340340

341-
expr.evaluate(&Scope::new(test_array)).unwrap();
341+
expr.evaluate(&test_array).unwrap();
342342
}
343343

344344
#[test]
@@ -348,7 +348,7 @@ mod tests {
348348
let test_array = StructArray::from_fields(&[("a", buffer![0, 1, 2].into_array())])
349349
.unwrap()
350350
.into_array();
351-
let actual_array = expr.evaluate(&Scope::new(test_array.clone())).unwrap();
351+
let actual_array = expr.evaluate(&test_array.clone()).unwrap();
352352
assert_eq!(actual_array.len(), test_array.len());
353353
assert_eq!(actual_array.as_struct_typed().nfields(), 0);
354354
}
@@ -391,10 +391,7 @@ mod tests {
391391
])
392392
.unwrap()
393393
.into_array();
394-
let actual_array = expr
395-
.evaluate(&Scope::new(test_array.clone()))
396-
.unwrap()
397-
.to_struct();
394+
let actual_array = expr.evaluate(&test_array.clone()).unwrap().to_struct();
398395

399396
assert_eq!(
400397
actual_array
@@ -435,10 +432,7 @@ mod tests {
435432
])
436433
.unwrap()
437434
.into_array();
438-
let actual_array = expr
439-
.evaluate(&Scope::new(test_array.clone()))
440-
.unwrap()
441-
.to_struct();
435+
let actual_array = expr.evaluate(&test_array.clone()).unwrap().to_struct();
442436

443437
assert_eq!(actual_array.names(), ["a", "c", "b", "d"]);
444438
}

vortex-expr/src/exprs/not.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ mod tests {
8989
use super::not;
9090
use crate::exprs::get_item::{col, get_item};
9191
use crate::exprs::root::root;
92-
use crate::{Scope, test_harness};
92+
use crate::test_harness;
9393

9494
#[test]
9595
fn invert_booleans() {
9696
let not_expr = not(root());
9797
let bools = BoolArray::from_iter([false, true, false, false, true, true]);
9898
assert_eq!(
9999
not_expr
100-
.evaluate(&Scope::new(bools.to_array()))
100+
.evaluate(&bools.to_array())
101101
.unwrap()
102102
.to_bool()
103103
.bit_buffer()

0 commit comments

Comments
 (0)