drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jinfeng Ni (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-3716) Drill should push filter past aggregate in order to improve query performance.
Date Thu, 27 Aug 2015 16:38:45 GMT
Jinfeng Ni created DRILL-3716:

             Summary: Drill should push filter past aggregate in order to improve query performance.
                 Key: DRILL-3716
                 URL: https://issues.apache.org/jira/browse/DRILL-3716
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
            Reporter: Jinfeng Ni
            Assignee: Jinfeng Ni
             Fix For: 1.2.0

For the following query which has a filter on top of an aggregation, Drill's currently push
the filter pass through the aggregation. As a result, we may miss some optimization opportunity.
For instance, such filter could potentially been pushed into scan if it qualifies for partition

For the following query:

select n_regionkey, cnt from 
     (select n_regionkey, count(*) cnt 
      from (select n.n_nationkey, n.n_regionkey, n.n_name 
               from cp.`tpch/nation.parquet` n 
                  left join 
                       cp.`tpch/region.parquet` r 
                on n.n_regionkey = r.r_regionkey) 
       group by n_regionkey) 
where n_regionkey = 2;

The current plan shows a filter (00-04) on top of aggregation(00-05). The better plan would
have the filter pushed pass the aggregation. 

The root cause of this problem is Drill's ruleset does not include  FilterAggregateTransoposeRule
from Calcite library.

00-01      Project(n_regionkey=[$0], cnt=[$1])
00-02        Project(n_regionkey=[$0], cnt=[$1])
00-03          SelectionVectorRemover
00-04            Filter(condition=[=($0, 2)])
00-05              StreamAgg(group=[{0}], cnt=[COUNT()])
00-06                Project(n_regionkey=[$0])
00-07                  MergeJoin(condition=[=($0, $1)], joinType=[left])
00-09                    SelectionVectorRemover
00-11                      Sort(sort0=[$0], dir0=[ASC])
00-13                        Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath
[path=classpath:/tpch/nation.parquet]], selectionRoot=classpath:/tpch/nation.parquet, numFiles=1,
00-08                    SelectionVectorRemover
00-10                      Sort(sort0=[$0], dir0=[ASC])
00-12                        Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath
[path=classpath:/tpch/region.parquet]], selectionRoot=classpath:/tpch/region.parquet, numFiles=1,

This message was sent by Atlassian JIRA

View raw message