Skip to content

Commit

Permalink
Merge pull request #21 from InscopeMetrics/intlong
Browse files Browse the repository at this point in the history
Switch int->long in HistogramDataPointImpl
  • Loading branch information
ddimensia committed Feb 26, 2020
2 parents 5bfaf5b + 1158528 commit 4f54b06
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public long getOriginalCount() {
*/
@Override
public long getSampleCount() {
int count = 0;
long count = 0;
for (Integer binSamples : map.values()) {
count += binSamples;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.inscopemetrics.kairosdb;

import org.junit.Assert;
import org.junit.Test;

import java.util.TreeMap;

public class HistogramDatapointImplTest {
@Test
public void testLargeSampleCount() {
final TreeMap<Double, Integer> map = new TreeMap<>();
map.put(1d, 2147483647);
map.put(2d, 2147483647);
map.put(3d, 2147483647);
map.put(4d, 2147483647);
final HistogramDataPointImpl dp = new HistogramDataPointImpl(1, map, -10, 10, 10, 10);
Assert.assertEquals(8589934588L, dp.getSampleCount());
}
}

0 comments on commit 4f54b06

Please sign in to comment.