@Override
    public long estimateCount(Sketch<?> sketch) {
        if (sketch instanceof NormalSketch) {
            return estimateCount((NormalSketch) sketch);
        } else {
            return estimateCount((SparseSketch) sketch);
        }
    }
@Test
    public void requireThatEstimateIsCorrectForSparseSketch() {
        SparseSketch sketch = new SparseSketch();
        HyperLogLogEstimator estimator = new HyperLogLogEstimator(10);
        long estimate = estimator.estimateCount(sketch);
        assertEquals(0, estimate);

        // Check that estimate is correct for every possible sketch size up to threshold
        for (int i = 1; i <= HyperLogLog.SPARSE_SKETCH_CONVERSION_THRESHOLD; i++) {
            sketch.aggregate(i);
            estimate = estimator.estimateCount(sketch);
            assertEquals(i, estimate);
        }
    }