Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
There're two issues with the following code:
private int calculateShardNum(KylinConfig kylinConfig, long dataSize) { long shardSize = kylinConfig.getExtTableSnapshotShardingMB() * 1024 * 1024; return dataSize < shardSize ? 1 : (int) (Math.ceil(dataSize / shardSize));
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.
Attachments
Issue Links
- links to