@@ -10,14 +10,16 @@ use delta_kernel::expressions::{
10
10
ColumnName , Expression , ExpressionRef , JunctionPredicate , JunctionPredicateOp , MapData ,
11
11
OpaqueExpression , OpaqueExpressionOpRef , OpaquePredicate , OpaquePredicateOpRef , Predicate ,
12
12
Scalar , StructData , Transform , UnaryExpression , UnaryExpressionOp , UnaryPredicate ,
13
- UnaryPredicateOp ,
13
+ UnaryPredicateOp , VariadicExpression , VariadicExpressionOp ,
14
14
} ;
15
15
16
16
use std:: ffi:: c_void;
17
17
18
18
type VisitLiteralFn < T > = extern "C" fn ( data : * mut c_void , sibling_list_id : usize , value : T ) ;
19
19
type VisitUnaryFn = extern "C" fn ( data : * mut c_void , sibling_list_id : usize , child_list_id : usize ) ;
20
20
type VisitBinaryFn = extern "C" fn ( data : * mut c_void , sibling_list_id : usize , child_list_id : usize ) ;
21
+ type VisitVariadicFn =
22
+ extern "C" fn ( data : * mut c_void , sibling_list_id : usize , child_list_id : usize ) ;
21
23
type VisitJunctionFn =
22
24
extern "C" fn ( data : * mut c_void , sibling_list_id : usize , child_list_id : usize ) ;
23
25
@@ -163,6 +165,9 @@ pub struct EngineExpressionVisitor {
163
165
/// Visits the `Divide` binary operator belonging to the list identified by `sibling_list_id`.
164
166
/// The operands will be in a _two_ item list identified by `child_list_id`
165
167
pub visit_divide : VisitBinaryFn ,
168
+ /// Visits the `Coalesce` variadic operator belonging to the list identified by `sibling_list_id`.
169
+ /// The operands will be in a list identified by `child_list_id`
170
+ pub visit_coalesce : VisitVariadicFn ,
166
171
/// Visits the `column` belonging to the list identified by `sibling_list_id`.
167
172
pub visit_column :
168
173
extern "C" fn ( data : * mut c_void , sibling_list_id : usize , name : KernelStringSlice ) ,
@@ -610,6 +615,16 @@ fn visit_expression_impl(
610
615
} ;
611
616
visit_fn ( visitor. data , sibling_list_id, child_list_id) ;
612
617
}
618
+ Expression :: Variadic ( VariadicExpression { op, exprs } ) => {
619
+ let child_list_id = call ! ( visitor, make_field_list, exprs. len( ) ) ;
620
+ for expr in exprs {
621
+ visit_expression_impl ( visitor, expr, child_list_id) ;
622
+ }
623
+ let visit_fn = match op {
624
+ VariadicExpressionOp :: Coalesce => visitor. visit_coalesce ,
625
+ } ;
626
+ visit_fn ( visitor. data , sibling_list_id, child_list_id) ;
627
+ }
613
628
Expression :: Opaque ( OpaqueExpression { op, exprs } ) => {
614
629
visit_expression_opaque ( visitor, op, exprs, sibling_list_id)
615
630
}
0 commit comments