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

    https://github.com/apache/drill/pull/517#discussion_r70487824
  
    --- Diff: 
exec/java-exec/src/main/codegen/templates/Decimal/CastIntDecimal.java ---
    @@ -64,7 +64,15 @@ public void setup() {
     
         public void eval() {
             out.scale = (int) scale.value;
    -        out.precision = (int) precision.value;
    --- End diff --
    
    The eval() method is called for every row, so there will be a performance 
overhead.  I  agree about the storage cost if we assume worst case precision; 
however the per-row evaluation should be as lightweight as possible and likely 
outweighs the storage consideration.  One option is to treat the IntDecimal and 
BigIntDecimal separately.  For IntDecimal the max int value is 2^31 - 1 which 
has a max precision of 10.  Similarly, there is an upper bound on the 
BigIntDecimal.  You could initialize the precision in the setup() method which 
is called *once*  per new schema (in the normal case the schema of that column 
does not change, this would avoid unnecessarily computing the precision).  


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