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

    https://github.com/apache/drill/pull/406#discussion_r55422075
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ConvertCountToDirectScan.java
 ---
    @@ -103,6 +104,10 @@ public void onMatch(RelOptRuleCall call) {
           return;
         }
     
    +    if (proj != null && !ProjectRemoveRule.isTrivial(proj)) {
    --- End diff --
    
    We have a check whether the input to count() is nullable in Line 115. In 
theory, if the input is non-nullable, then count(non-nullalbe expression) = 
rowcount.
    
    My guess is that the query (case expression) with incorrect result is 
caused by the wrong type resolution for the case expression. 
    
     


---
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