gstvg commented on code in PR #22362:
URL: https://github.com/apache/datafusion/pull/22362#discussion_r3291605944


##########
datafusion/proto-models/proto/datafusion.proto:
##########
@@ -430,6 +430,10 @@ message LogicalExprNode {
 
     // Subquery expressions
     ScalarSubqueryExprNode scalar_subquery_expr = 36;
+
+    HigherOrderUDFExprNode higher_order_udf_expr = 37;
+    Lambda lambda = 38;
+    LambdaVariable lambda_variable = 39;

Review Comment:
   Isn't better being ordered by field id? so the next one who add a node can 
spot the next available field id right away



##########
datafusion/proto/src/physical_plan/to_proto.rs:
##########
@@ -575,6 +577,41 @@ pub fn serialize_physical_expr_with_converter(
                 }),
             )),
         })
+    } else if let Some(expr) = expr.downcast_ref::<HigherOrderFunctionExpr>() {
+        let mut buf = Vec::new();
+        codec.try_encode_higher_order_function(expr.fun(), &mut buf)?;
+        Ok(protobuf::PhysicalExprNode {
+            expr_id,
+            expr_type: 
Some(protobuf::physical_expr_node::ExprType::HigherOrderUdf(
+                protobuf::PhysicalHigherOrderUdfNode {
+                    name: expr.name().to_string(),
+                    args: serialize_physical_exprs(expr.args(), codec, 
proto_converter)?,
+                    fun_definition: (!buf.is_empty()).then_some(buf),
+                },
+            )),
+        })
+    } else if let Some(lambda) = expr.downcast_ref::<LambdaExpr>() {
+        Ok(protobuf::PhysicalExprNode {
+            expr_id,
+            expr_type: 
Some(protobuf::physical_expr_node::ExprType::Lambda(Box::new(
+                protobuf::PhysicalLambdaExprNode {
+                    params: lambda.params().to_vec(),
+                    body: Some(Box::new(
+                        proto_converter.physical_expr_to_proto(lambda.body(), 
codec)?,
+                    )),
+                },
+            ))),
+        })
+    } else if let Some(var) = expr.downcast_ref::<LambdaVariable>() {
+        Ok(protobuf::PhysicalExprNode {
+            expr_id,
+            expr_type: 
Some(protobuf::physical_expr_node::ExprType::LambdaVariable(
+                PhysicalLambdaVariableExprNode {
+                    index: var.index() as u32,

Review Comment:
   This is used now after lambda capture got merged. The variable below has 
index 1, for example: 
https://github.com/apache/datafusion/blob/50d74a704d7f35a6cc184251a8f1236cd94de684/datafusion/sqllogictest/test_files/array/array_transform.slt#L102



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to