goldmedal commented on code in PR #14031:
URL: https://github.com/apache/datafusion/pull/14031#discussion_r1906575417


##########
datafusion/sql/src/unparser/plan.rs:
##########
@@ -729,12 +722,16 @@ impl Unparser<'_> {
                     .map(|input| self.select_to_sql_expr(input, query))
                     .collect::<Result<Vec<_>>>()?;
 
-                let union_expr = SetExpr::SetOperation {
-                    op: ast::SetOperator::Union,
-                    set_quantifier: ast::SetQuantifier::All,
-                    left: Box::new(input_exprs[0].clone()),
-                    right: Box::new(input_exprs[1].clone()),
-                };
+                let union_expr = input_exprs
+                    .into_iter()
+                    .rev()

Review Comment:
   It's better to add a comment to explain why reverse here.



##########
datafusion/sql/src/unparser/plan.rs:
##########
@@ -729,12 +722,16 @@ impl Unparser<'_> {
                     .map(|input| self.select_to_sql_expr(input, query))
                     .collect::<Result<Vec<_>>>()?;
 
-                let union_expr = SetExpr::SetOperation {
-                    op: ast::SetOperator::Union,
-                    set_quantifier: ast::SetQuantifier::All,
-                    left: Box::new(input_exprs[0].clone()),
-                    right: Box::new(input_exprs[1].clone()),
-                };
+                let union_expr = input_exprs

Review Comment:
   ```suggestion
                   let Some(union_expr) = input_exprs
   ```
   Instead of unwrapping it directly, returning an error if the option is none 
is better. You can refer to how L736 did it.



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