Dandandan commented on a change in pull request #1068:
URL: https://github.com/apache/arrow-datafusion/pull/1068#discussion_r720864937



##########
File path: datafusion/src/sql/planner.rs
##########
@@ -170,8 +170,21 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
                     let right_plan = self.set_expr_to_plan(right.as_ref(), 
None, ctes)?;
                     union_with_alias(left_plan, right_plan, alias)
                 }
+                (SetOperator::Union, false) => {
+                    let left_plan = self.set_expr_to_plan(left.as_ref(), None, 
ctes)?;
+                    let right_plan = self.set_expr_to_plan(right.as_ref(), 
None, ctes)?;
+                    let union_plan = union_with_alias(left_plan, right_plan, 
alias)?;
+                    let projection_expr =
+                        expand_wildcard(union_plan.schema(), &union_plan)?;
+                    self.project(
+                        LogicalPlanBuilder::from(union_plan)
+                            .aggregate(projection_expr, vec![])?
+                            .build()?,
+                        vec![Expr::Wildcard],
+                    )
+                }
                 _ => Err(DataFusionError::NotImplemented(format!(
-                    "Only UNION ALL is supported, found {}",
+                    "Only UNION ALL and UNION are supported, found {}",

Review comment:
       ```suggestion
                       "Only UNION ALL and UNION [DISTINCT] are supported, 
found {}",
   ```




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