Edward Zhang created KYLIN-1457:
-----------------------------------

             Summary: BigDecimalSerializer should use precision to check out of 
range
                 Key: KYLIN-1457
                 URL: https://issues.apache.org/jira/browse/KYLIN-1457
             Project: Kylin
          Issue Type: Bug
    Affects Versions: Future
            Reporter: Edward Zhang
            Assignee: Edward Zhang
            Priority: Minor
             Fix For: Future


It is not correct to use length of byte array to judge if a value is out of 
range
        byte[] bytes = value.unscaledValue().toByteArray();
        if (bytes.length + 2 > maxLength) {
            throw new IllegalArgumentException("'" + value + "' exceeds the 
expected length for type " + type);
        }

Because length of byte array is not exactly 1 byte per 2 decimal digits.
Instead we should use precision to decide if the value is out of range



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to