jayzhan211 commented on code in PR #8636:
URL: https://github.com/apache/arrow-datafusion/pull/8636#discussion_r1435451361


##########
datafusion/sql/src/expr/mod.rs:
##########
@@ -98,11 +99,184 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                 StackEntry::Operator(op) => {
                     let right = eval_stack.pop().unwrap();
                     let left = eval_stack.pop().unwrap();
-                    let expr = Expr::BinaryExpr(BinaryExpr::new(
-                        Box::new(left),
-                        op,
-                        Box::new(right),
-                    ));
+
+                    // Summary of the logic below:
+                    // array || array -> array concat
+                    // array || scalar -> array append
+                    // scalar || array -> array prepend
+                    // (arry concat, array append, array prepend) || array -> 
array concat
+                    // (arry concat, array append, array prepend) || scalar -> 
array append
+
+                    // Convert `Array StringConcat Array` to 
ScalarFunction::ArrayConcat
+                    let expr = match (op, &left, &right) {
+                        // Chain concat operator (a || b) || array,

Review Comment:
   This is really long. :( 
   Not yet find a nicer way



-- 
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]

Reply via email to