You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/02 17:30:48 UTC
[GitHub] [arrow-datafusion] comphead commented on issue #3248: Remove redundant projection when querying a view
comphead commented on issue #3248:
URL: https://github.com/apache/arrow-datafusion/issues/3248#issuecomment-1235749611
The problem is
```
❯ create view v as select 1 as a, 2 as b, 3 as c;
0 rows in set. Query took 0.001 seconds.
❯ explain select * from (select b from v);
+---------------+---------------------------------------+
| plan_type | plan |
+---------------+---------------------------------------+
| logical_plan | Projection: #v.b |
| | TableScan: v projection=[b] |
| physical_plan | ProjectionExec: expr=[b@0 as b] |
| | ProjectionExec: expr=[b@0 as b] |
| | ProjectionExec: expr=[2 as b] |
| | EmptyExec: produce_one_row=true |
| | |
+---------------+---------------------------------------+
```
The same for table
```
❯ create table v1 as select 1 as a, 2 as b, 3 as c;
+---+---+---+
| a | b | c |
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
1 row in set. Query took 0.003 seconds.
❯ explain select * from (select b from v1);
+---------------+-------------------------------------------------+
| plan_type | plan |
+---------------+-------------------------------------------------+
| logical_plan | Projection: #v1.b |
| | TableScan: v1 projection=[b] |
| physical_plan | ProjectionExec: expr=[b@0 as b] |
| | MemoryExec: partitions=1, partition_sizes=[1] |
| | |
+---------------+-------------------------------------------------+
```
@andygrove afaik those physical plans should be the same?
--
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