Created
August 19, 2022 18:19
-
-
Save aaneja/709231077372750912acb25d69e77b2d to your computer and use it in GitHub Desktop.
net.agkn.hll.HLL v. com.facebook.airlift.stats.cardinality.HyperLogLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net.agkn.hll.HLL cardinality estimate : 100000 | |
com.facebook.airlift.stats.cardinality.HyperLogLog cardinality estimate : 100426 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testHLL() { | |
HLL hll = new HLL(25, 8, 18, true, HLLType.EMPTY); | |
final HyperLogLog hyperLogLog = HyperLogLog.newInstance(65536); | |
for (long i = 0; i < 100000L; i++) { | |
hll.addRaw(i); | |
hyperLogLog.add(i); | |
} | |
System.out.printf("%s cardinality estimate : %d%n", HLL.class.getCanonicalName(), hll.cardinality()); | |
System.out.printf("%s cardinality estimate : %d%n", HyperLogLog.class.getCanonicalName(), hyperLogLog.cardinality()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment