Github user daveoshinsky commented on the issue:

    https://github.com/apache/drill/pull/517
  
    Thanks Jinfeng for the very clear explanation, and pointer to 
ExpressionTreeMaterializer.java.  Rather than change 
ExpressionTreeMaterializer.java, with which I am completely unfamiliar, I added 
another change to CastIntDecimal.java to only calculate the precision when the 
supplied one is zero.  I hope the amended fix is sufficient for now.  There 
might be other cases where the supplied precision is invalid (zero), and this 
change will handle those. 
    
        On Wednesday, August 3, 2016 7:18 PM, Jinfeng Ni 
<[email protected]> wrote:
     
    
     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—
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub, or mute the thread.  
    
      


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to