Skip to content

Commit fa9b3e3

Browse files
committed
Add higher-order function expressions
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
1 parent d8e744f commit fa9b3e3

20 files changed

Lines changed: 1840 additions & 83 deletions

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn make_free_field_annotator(
4242
) -> impl AnnotationFn<Expression, Annotation = FieldName> {
4343
move |expr: &Expression| match expr {
4444
Expression::Root => scope.names().iter().cloned().collect(),
45-
Expression::Lambda(_) | Expression::Variable(_) => vec![],
45+
Expression::HigherOrder { .. } | Expression::Lambda(_) | Expression::Variable(_) => vec![],
4646
Expression::Scalar {
4747
scalar_fn,
4848
children,
@@ -72,7 +72,9 @@ pub fn make_bound_free_field_annotator(
7272
) -> impl AnnotationFn<BoundExpression, Annotation = FieldName> {
7373
move |expr: &BoundExpression| match expr {
7474
BoundExpression::Root { .. } => scope.names().iter().cloned().collect(),
75-
BoundExpression::Lambda(_) | BoundExpression::Variable(_) => vec![],
75+
BoundExpression::HigherOrder { .. }
76+
| BoundExpression::Lambda(_)
77+
| BoundExpression::Variable(_) => vec![],
7678
BoundExpression::Scalar {
7779
scalar_fn,
7880
children,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ pub fn label_infallible(expr: &Expression) -> BooleanLabels<'_> {
1515
expr,
1616
|expr| match expr {
1717
Expression::Scalar { scalar_fn, .. } => scalar_fn.signature().is_infallible(),
18+
// Lambda fallibility is function-defined, so an unbound HOF is conservative.
19+
Expression::HigherOrder { .. } => false,
1820
// The scope itself cannot fail.
1921
Expression::Root => true,
2022
// Fallibility is determined by the enclosing HOF.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pub fn label_strict(expr: &Expression) -> BooleanLabels<'_> {
1414
expr,
1515
|expr| match expr {
1616
Expression::Scalar { scalar_fn, .. } => scalar_fn.signature().is_strict(),
17+
// Strictness across lambda invocation domains is function-defined.
18+
Expression::HigherOrder { .. } => false,
1719
Expression::Root => true,
1820
// Strictness is determined by the enclosing HOF.
1921
Expression::Variable(_) | Expression::Lambda(_) => true,

0 commit comments

Comments
 (0)