Skip to content

Commit ab17348

Browse files
committed
Expressions
Signed-off-by: Nicholas Gates <[email protected]>
1 parent b03c1dd commit ab17348

File tree

16 files changed

+52
-56
lines changed

16 files changed

+52
-56
lines changed

vortex-array/src/expr/analysis/fallible.rs

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

4-
use crate::expr::Expression;
54
use crate::expr::analysis::BooleanLabels;
65
use crate::expr::label_tree;
6+
use crate::expr::Expression;
77

88
pub fn label_is_fallible(expr: &Expression) -> BooleanLabels<'_> {
9-
label_tree(expr, |expr| expr.is_fallible(), |acc, &child| acc | child)
9+
label_tree(
10+
expr,
11+
|expr| expr.signature().is_fallible(),
12+
|acc, &child| acc | child,
13+
)
1014
}
1115

1216
#[cfg(test)]
@@ -17,8 +21,8 @@ mod tests {
1721
use crate::expr::exprs::get_item::col;
1822
use crate::expr::exprs::is_null::is_null;
1923
use crate::expr::exprs::literal::lit;
20-
use crate::expr::exprs::merge::DuplicateHandling;
2124
use crate::expr::exprs::merge::merge_opts;
25+
use crate::expr::exprs::merge::DuplicateHandling;
2226
use crate::expr::exprs::not::not;
2327

2428
#[test]

vortex-array/src/expr/analysis/immediate_access.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use vortex_dtype::StructFields;
66
use vortex_error::VortexExpect;
77
use vortex_utils::aliases::hash_set::HashSet;
88

9-
use crate::expr::Expression;
109
use crate::expr::analysis::AnnotationFn;
1110
use crate::expr::analysis::Annotations;
1211
use crate::expr::descendent_annotations;
1312
use crate::expr::exprs::get_item::GetItem;
1413
use crate::expr::exprs::root::Root;
1514
use crate::expr::exprs::select::Select;
15+
use crate::expr::Expression;
1616

1717
pub type FieldAccesses<'a> = Annotations<'a, FieldName>;
1818

@@ -24,9 +24,9 @@ pub fn annotate_scope_access(scope: &StructFields) -> impl AnnotationFn<Annotati
2424
"cannot analyse select, simplify the expression"
2525
);
2626

27-
if let Some(get_item) = expr.as_opt::<GetItem>() {
28-
if get_item.child(0).is::<Root>() {
29-
return vec![get_item.data().clone()];
27+
if let Some(field_name) = expr.as_opt::<GetItem>() {
28+
if expr.child(0).is::<Root>() {
29+
return vec![field_name.clone()];
3030
}
3131
} else if expr.is::<Root>() {
3232
return scope.names().iter().cloned().collect();

vortex-array/src/expr/analysis/null_sensitive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub type BooleanLabels<'a> = HashMap<&'a Expression, bool>;
1515
pub fn label_null_sensitive(expr: &Expression) -> BooleanLabels<'_> {
1616
label_tree(
1717
expr,
18-
|expr| expr.is_null_sensitive(),
18+
|expr| expr.signature().is_null_sensitive(),
1919
|acc, &child| acc | child,
2020
)
2121
}

vortex-array/src/expr/exprs/between.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl VTable for Between {
112112
)
113113
}
114114

115-
fn return_dtype(&self, options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
115+
fn return_dtype(&self, _options: &Self::Options, arg_dtypes: &[DType]) -> VortexResult<DType> {
116116
let arr_dt = &arg_dtypes[0];
117117
let lower_dt = &arg_dtypes[1];
118118
let upper_dt = &arg_dtypes[2];
@@ -149,7 +149,7 @@ impl VTable for Between {
149149
between_compute(&arr, &lower, &upper, options)
150150
}
151151

152-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
152+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
153153
todo!()
154154
}
155155

vortex-array/src/expr/exprs/binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl VTable for Binary {
123123
}
124124
}
125125

126-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
126+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
127127
todo!()
128128
}
129129

vortex-array/src/expr/exprs/dynamic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl VTable for DynamicComparison {
115115
.into_array())
116116
}
117117

118-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
118+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
119119
todo!()
120120
}
121121

vortex-array/src/expr/exprs/like.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl VTable for Like {
109109
like_compute(&child, &pattern, *options)
110110
}
111111

112-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
112+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
113113
todo!()
114114
}
115115

vortex-array/src/expr/exprs/literal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ impl VTable for Literal {
7878
fn evaluate(
7979
&self,
8080
scalar: &Scalar,
81-
expr: &Expression,
81+
_expr: &Expression,
8282
scope: &ArrayRef,
8383
) -> VortexResult<ArrayRef> {
8484
Ok(ConstantArray::new(scalar.clone(), scope.len()).into_array())
8585
}
8686

87-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
87+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
8888
todo!()
8989
}
9090

9191
fn stat_expression(
9292
&self,
9393
scalar: &Scalar,
94-
expr: &Expression,
94+
_expr: &Expression,
9595
stat: Stat,
9696
_catalog: &dyn StatsCatalog,
9797
) -> Option<Expression> {

vortex-array/src/expr/exprs/merge/mod.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ use vortex_dtype::DType;
1111
use vortex_dtype::FieldNames;
1212
use vortex_dtype::Nullability;
1313
use vortex_dtype::StructFields;
14-
use vortex_error::VortexResult;
1514
use vortex_error::vortex_bail;
15+
use vortex_error::VortexResult;
1616
use vortex_utils::aliases::hash_set::HashSet;
1717
use vortex_vector::Datum;
1818

19-
use crate::Array;
20-
use crate::ArrayRef;
21-
use crate::IntoArray as _;
22-
use crate::ToCanonical;
2319
use crate::arrays::StructArray;
2420
use crate::expr::Arity;
2521
use crate::expr::ChildName;
@@ -28,8 +24,11 @@ use crate::expr::ExprId;
2824
use crate::expr::Expression;
2925
use crate::expr::VTable;
3026
use crate::expr::VTableExt;
31-
use crate::expr::get_item;
3227
use crate::validity::Validity;
28+
use crate::Array;
29+
use crate::ArrayRef;
30+
use crate::IntoArray as _;
31+
use crate::ToCanonical;
3332

3433
/// Merge zero or more expressions that ALL return structs.
3534
///
@@ -65,7 +64,7 @@ impl VTable for Merge {
6564
}
6665

6766
fn arity(&self, _options: &Self::Options) -> Arity {
68-
Arity::Variadic
67+
Arity::Variadic { min: 0, max: None }
6968
}
7069

7170
fn child_name(&self, _instance: &Self::Options, child_idx: usize) -> ChildName {
@@ -178,7 +177,7 @@ impl VTable for Merge {
178177
)
179178
}
180179

181-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
180+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
182181
todo!()
183182
}
184183

@@ -236,20 +235,20 @@ pub fn merge_opts(
236235
#[cfg(test)]
237236
mod tests {
238237
use vortex_buffer::buffer;
239-
use vortex_error::VortexResult;
240238
use vortex_error::vortex_bail;
239+
use vortex_error::VortexResult;
241240

242241
use super::merge;
243-
use crate::Array;
244-
use crate::IntoArray;
245-
use crate::ToCanonical;
246242
use crate::arrays::PrimitiveArray;
247243
use crate::arrays::StructArray;
248-
use crate::expr::Expression;
249244
use crate::expr::exprs::get_item::get_item;
250-
use crate::expr::exprs::merge::DuplicateHandling;
251245
use crate::expr::exprs::merge::merge_opts;
246+
use crate::expr::exprs::merge::DuplicateHandling;
252247
use crate::expr::exprs::root::root;
248+
use crate::expr::Expression;
249+
use crate::Array;
250+
use crate::IntoArray;
251+
use crate::ToCanonical;
253252

254253
fn primitive_field(array: &dyn Array, field_path: &[&str]) -> VortexResult<PrimitiveArray> {
255254
let mut field_path = field_path.iter();

vortex-array/src/expr/exprs/pack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl VTable for Pack {
141141
Ok(StructArray::try_new(options.names.clone(), value_arrays, len, validity)?.into_array())
142142
}
143143

144-
fn execute(&self, data: &Self::Options, args: ExecutionArgs) -> VortexResult<Datum> {
144+
fn execute(&self, _data: &Self::Options, _args: ExecutionArgs) -> VortexResult<Datum> {
145145
todo!()
146146
}
147147

0 commit comments

Comments
 (0)