Blizzara commented on code in PR #11234:
URL: https://github.com/apache/datafusion/pull/11234#discussion_r1664846618


##########
datafusion/substrait/src/logical_plan/consumer.rs:
##########
@@ -1125,17 +1125,45 @@ pub async fn from_substrait_rex(
                     expr::ScalarFunction::new_udf(func.to_owned(), args),
                 )))
             } else if let Ok(op) = name_to_op(fn_name) {
-                if args.len() != 2 {
+                if f.arguments.len() < 2 {
                     return not_impl_err!(
-                        "Expect two arguments for binary operator {op:?}"
+                        "Expect at least two arguments for binary operator 
{op:?}, the provided number of operators is {:?}",
+                        f.arguments.len()
                     );
                 }
 
-                Ok(Arc::new(Expr::BinaryExpr(BinaryExpr {
-                    left: Box::new(args[0].to_owned()),
-                    op,
-                    right: Box::new(args[1].to_owned()),
-                })))
+                let mut combined_expr: Option<Arc<Expr>> = None;
+
+                // Iterate through all arguments to construct the combined 
expression

Review Comment:
   This is nice, maybe expand the comment a bit though to make it clearer why 
we do this, something like:
   > Some expressions are binary in DataFusion but take in a variadic number of 
args in Substrait. In those cases we iterate through all the arguments, 
applying the binary expression against them all
   
   but worded a bit better 😅 



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to