Github user hsuanyi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/397#discussion_r54956169
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/logical/DrillReduceAggregatesRule.java
 ---
    @@ -100,8 +108,13 @@ public void onMatch(RelOptRuleCall ruleCall) {
        */
       private boolean containsAvgStddevVarCall(List<AggregateCall> 
aggCallList) {
         for (AggregateCall call : aggCallList) {
    -      if (call.getAggregation() instanceof SqlAvgAggFunction
    -          || call.getAggregation() instanceof SqlSumAggFunction) {
    +      SqlAggFunction sqlAggFunction = call.getAggregation();
    +      if(sqlAggFunction instanceof DrillCalciteSqlWrapper) {
    --- End diff --
    
    Yeah,... I see the point. But this is necessary to still have wrapper here. 
    
    For example, the type of avg(integer_type_col) in Calcite is defined as 
Integer. Thus, say, if the wrapper is removed somehow before this rule is 
fired, Calcite will complain the type it sees here (Integer) does not match 
with that (Double) we inferred before.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to