Github user jinfengni commented on the issue:

    https://github.com/apache/drill/pull/517
  
    I agreed with Aman that the eval() of CastIntDecimal28Sparse() should not 
ignore the specified scale/precision, if they are passed as parameters. 
    
    As you analyzed, the problem is the scale/precision is 0 for a int constant 
value, which is not right. We should fix place where scale/precision is 
specified wrongly.  Ignoring scale/precision and re-calcualting them in eval() 
means Drill has to apply that logic per input row.
    
    The reason that you saw eval() is called only once:
    Filter employee_id = 170, 
      is   employee_id = castIntDecimal28Sparse(170, scale, precision). // 
scale and precision is wrongly 0.
    
    Since RHS is a constant, Drill will evaluate only once, even you have 
multiple rows. However, this is not true, if it's not a constant expression. 
    
    To me, you point to the right cause of the problem. But we need get better 
place to apply the fix ( not in eval() ) method. 
    
    The place where we get scale/precision as 0 
    
    
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java#L315-L316
    



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