@Test(dataProvider = "provideStandardErrors") public void testNoPositions(double maxStandardError) { assertCount(ImmutableList.of(), maxStandardError, 0); }
@Test(dataProvider = "provideStandardErrors") public void testAllPositionsNull(double maxStandardError) { assertCount(Collections.nCopies(100, null), maxStandardError, 0); }
@Test(dataProvider = "provideStandardErrors") public void testSinglePosition(double maxStandardError) { assertCount(ImmutableList.of(randomValue()), maxStandardError, 1); }
@Test(dataProvider = "provideStandardErrors") public void testMixedNullsAndNonNulls(double maxStandardError) { int uniques = getUniqueValuesCount(); List<Object> baseline = createRandomSample(uniques, (int) (uniques * 1.5)); // Randomly insert nulls // We need to retain the preexisting order to ensure that the HLL can generate the same estimates. Iterator<Object> iterator = baseline.iterator(); List<Object> mixed = new ArrayList<>(); while (iterator.hasNext()) { mixed.add(ThreadLocalRandom.current().nextBoolean() ? null : iterator.next()); } assertCount(mixed, maxStandardError, estimateGroupByCount(baseline, maxStandardError)); }
@Test(dataProvider = "provideStandardErrors") public void testAllPositionsNull(double maxStandardError) throws Exception { assertCount(Collections.nCopies(100, null), maxStandardError, 0); }
@Test(dataProvider = "provideStandardErrors") public void testNoPositions(double maxStandardError) throws Exception { assertCount(ImmutableList.of(), maxStandardError, 0); }
@Test(dataProvider = "provideStandardErrors") public void testSinglePosition(double maxStandardError) throws Exception { assertCount(ImmutableList.of(randomValue()), maxStandardError, 1); }
@Test(dataProvider = "provideStandardErrors") public void testMixedNullsAndNonNulls(double maxStandardError) throws Exception { List<Object> baseline = createRandomSample(10000, 15000); // Randomly insert nulls // We need to retain the preexisting order to ensure that the HLL can generate the same estimates. Iterator<Object> iterator = baseline.iterator(); List<Object> mixed = new ArrayList<>(); while (iterator.hasNext()) { mixed.add(ThreadLocalRandom.current().nextBoolean() ? null : iterator.next()); } assertCount(mixed, maxStandardError, estimateGroupByCount(baseline, maxStandardError)); }