drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinfengni <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4474: Ensure that ConvertCountToDirectSc...
Date Wed, 09 Mar 2016 00:59:26 GMT
Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/416#discussion_r55457004
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java
---
    @@ -117,6 +117,24 @@ public void onMatch(RelOptRuleCall call) {
           } else if (aggCall.getArgList().size() == 1) {
           // count(columnName) ==> Agg ( Scan )) ==> columnValueCount
             int index = aggCall.getArgList().get(0);
    +
    +        if (proj != null) {
    +          // project in the middle of Agg and Scan : Only when input of AggCall is a
RexInputRef in Project, we find the index of Scan's field.
    +          // For instance,
    +          // Agg - count($0)
    +          //  \
    +          //  Proj - Exp={$1}
    +          //    \
    +          //   Scan (col1, col2).
    +          // return count of "col2" in Scan's metadata, if found.
    +
    +          if (proj.getProjects().get(index) instanceof RexInputRef) {
    +            index = ((RexInputRef) proj.getProjects().get(index)).getIndex();
    --- End diff --
    
    I added two more case: count(100) and count(1+2) to check the count pushdown happen. 
    
    Currently, count( 1 + non-nulllable-col) will not pushdown count. That's because Drill
return nullable-ANY for "+" function.  With Sean's type exposure patch, it should get the
right type for "+" in planning time, and it will get count pushddown as well. 
     


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message