You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Shaofeng SHI (JIRA)" <ji...@apache.org> on 2018/06/11 06:55:00 UTC
[jira] [Resolved] (KYLIN-3398) Inaccurate arithmetic operation in
LookupTableToHFileJob#calculateShardNum
[ https://issues.apache.org/jira/browse/KYLIN-3398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shaofeng SHI resolved KYLIN-3398.
---------------------------------
Resolution: Fixed
> 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: nichunen
> Priority: Major
> Fix For: v2.4.0
>
>
> 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)