You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/05/17 19:52:07 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6373: Fix UNION ALL aliasing

alamb commented on code in PR #6373:
URL: https://github.com/apache/arrow-datafusion/pull/6373#discussion_r1196987499


##########
datafusion/core/tests/sqllogictests/test_files/union.slt:
##########
@@ -446,3 +446,30 @@ drop table t1
 
 statement ok
 drop table t2
+
+# test UNION ALL aliases correctly with all aliased

Review Comment:
   I double checked that this plan is different on main (the aliases remain as `a`, `b` and `c`) 👍 
   
   ```
   ❯ explain select 1 a group by a union all select 2 b union all select 3 c;
   +---------------+--------------------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                                                                         |
   +---------------+--------------------------------------------------------------------------------------------------------------+
   | logical_plan  | Union                                                                                                        |
   |               |   Projection: Int64(1) AS a                                                                                  |
   |               |     Aggregate: groupBy=[[Int64(1)]], aggr=[[]]                                                               |
   |               |       EmptyRelation                                                                                          |
   |               |   Projection: Int64(2) AS b                                                                                  |
   |               |     EmptyRelation                                                                                            |
   |               |   Projection: Int64(3) AS c                                                                                  |
   |               |     EmptyRelation                                                                                            |
   | physical_plan | UnionExec                                                                                                    |
   |               |   ProjectionExec: expr=[Int64(1)@0 as a]                                                                     |
   |               |     AggregateExec: mode=FinalPartitioned, gby=[Int64(1)@0 as Int64(1)], aggr=[]                              |
   |               |       CoalesceBatchesExec: target_batch_size=8192                                                            |
   |               |         RepartitionExec: partitioning=Hash([Column { name: "Int64(1)", index: 0 }], 16), input_partitions=16 |
   |               |           RepartitionExec: partitioning=RoundRobinBatch(16), input_partitions=1                              |
   |               |             AggregateExec: mode=Partial, gby=[1 as Int64(1)], aggr=[]                                        |
   |               |               EmptyExec: produce_one_row=true                                                                |
   |               |   ProjectionExec: expr=[2 as b]                                                                              |
   |               |     EmptyExec: produce_one_row=true                                                                          |
   |               |   ProjectionExec: expr=[3 as c]                                                                              |
   |               |     EmptyExec: produce_one_row=true                                                                          |
   |               |                                                                                                              |
   +---------------+--------------------------------------------------------------------------------------------------------------+
   ```



-- 
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-unsubscribe@arrow.apache.org

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