You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by "Edward Zhang (JIRA)" <ji...@apache.org> on 2016/02/28 19:07:18 UTC

[jira] [Created] (KYLIN-1457) BigDecimalSerializer should use precision to check out of range

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)