I have a use case where I need to check if an element already exists in the Hyperloglog and if not, I need to make a hbase call. Do we have any method IN JAVA to check if element already exists in HyperLogLog
Asked
Active
Viewed 226 times
0
-
What implementation of HLL are you using? – geobreze Nov 22 '21 at 14:55
-
private static HLL hllActiveUsersWithPID = new HLL(14,5); HashFunction hashFunction = Hashing.murmur3_128(); This is the use case – Pranjal Tripathi Nov 22 '21 at 14:58
-
1Is that a library you're using? https://github.com/aggregateknowledge/java-hll – geobreze Nov 22 '21 at 15:01
-
yes that is the library I am using – Pranjal Tripathi Nov 23 '21 at 04:43
-
You can add an element and check whether cardinality has changed or not. If it changed, then HLL didn't contain this element – geobreze Nov 23 '21 at 09:04
1 Answers
1
HyperLogLog is not suitable for checking element memberships. Use a Bloom filter, if you need a compact data structure for approximative set membership testing. More recent, but more complicated alternatives would be Cuckoo, XOR, or Ribbon filters.

otmar
- 386
- 1
- 9