[ https://issues.apache.org/jira/browse/DRILL-3130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Victoria Markman reopened DRILL-3130: ------------------------------------- Sean, I think this fix was rolled back because it was causing regression: https://issues.apache.org/jira/browse/DRILL-3257 With 1.2.0 #Mon Oct 05 19:59:48 UTC 2015 git.commit.id.abbrev=27a5abc {code} 0: jdbc:drill:schema=dfs> explain plan for select * from (select a1, b1, c1 from t1 union all select a2, b2, c2 from t2 ) where a1 = 10; +------+------+ | text | json | +------+------+ | 00-00 Screen 00-01 Project(a1=[$0], b1=[$1], c1=[$2]) 00-02 SelectionVectorRemover 00-03 Filter(condition=[=($0, 10)]) 00-04 UnionAll(all=[true]) 00-06 Project(a1=[$2], b1=[$1], c1=[$0]) 00-08 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=maprfs:/drill/testdata/subqueries/t1/0_0_0.parquet]], selectionRoot=maprfs:/drill/testdata/subqueries/t1, numFiles=1, usedMetadataFile=false, columns=[`a1`, `b1`, `c1`]]]) 00-05 Project(a2=[$1], b2=[$0], c2=[$2]) 00-07 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=maprfs:/drill/testdata/subqueries/t2/0_0_0.parquet]], selectionRoot=maprfs:/drill/testdata/subqueries/t2, numFiles=1, usedMetadataFile=false, columns=[`a2`, `b2`, `c2`]]]) {code} > Project can be pushed below union all / union to improve performance > -------------------------------------------------------------------- > > Key: DRILL-3130 > URL: https://issues.apache.org/jira/browse/DRILL-3130 > Project: Apache Drill > Issue Type: Improvement > Components: Query Planning & Optimization > Reporter: Sean Hsuan-Yi Chu > Assignee: Sean Hsuan-Yi Chu > Fix For: 1.1.0 > > > A query such as > {code} > Select a from > (select a, b, c, ..., union all select a, b, c, ...) > {code} > will perform Union-All over all the specified columns on the two sides, > despite the fact that only one column is asked for at the end. Ideally, we > should perform ProjectPushDown rule for Union & Union-All to avoid them to > generate results which will be discarded at the end. -- This message was sent by Atlassian JIRA (v6.3.4#6332)