kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KYLIN-3398) Inaccurate arithmetic operation in LookupTableToHFileJob#calculateShardNum
Date Sun, 10 Jun 2018 07:09:00 GMT

    [ https://issues.apache.org/jira/browse/KYLIN-3398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16507289#comment-16507289
] 

ASF subversion and git services commented on KYLIN-3398:
--------------------------------------------------------

Commit ff122ebdde3a2486bede103c589e0aa4149e1658 in kylin's branch refs/heads/master from [~nichunen]
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=ff122eb ]

KYLIN-3398 Fix inaccurate arithmetic operations in LookupTableToHFileJob#calculateShardNum


> Inaccurate arithmetic operation in LookupTableToHFileJob#calculateShardNum
> --------------------------------------------------------------------------
>
>                 Key: KYLIN-3398
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3398
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: jiatao.tao
>            Priority: Major
>
> There're two issues with the following code:
> {code}
>     private int calculateShardNum(KylinConfig kylinConfig, long dataSize) {
>         long shardSize = kylinConfig.getExtTableSnapshotShardingMB() * 1024 * 1024;
>         return dataSize < shardSize ? 1 : (int) (Math.ceil(dataSize / shardSize));
> {code}
> getExtTableSnapshotShardingMB returns an int. The multiplication is done using 32-bit
arithmetic, and then used in a context that expects an expression of type "long".
> Second, Math.ceil expects a double. The integer division would lose some precision.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message