Closed safetys123 closed 6 years ago
@safetys123 Thank you for raising the issue. I didn't know that it has such feature. It seems they added it in recent versions. Do you have a particular use case in your mind?
To implement that feature one needs to implement getBitCount
in UnsafeBitArray
and use the formula from the guava source code 😉
https://github.com/alexandrnikitin/bloom-filter-scala/blob/0a1265e07934d3c33ba7e0c1971eabea80b5b528/bloom-filter/src/main/scala/bloomfilter/mutable/UnsafeBitArray.scala#L51-L53
Guava code of approximateElementCount()
for reference https://github.com/google/guava/blob/207e0716eb9d2540c072d3003a643e80b75f8fc5/guava/src/com/google/common/hash/BloomFilter.java#L191
Will you have time to do it? I'll be happy to merge it!
@alexandrnikitin I just know a litter java, don't know scala, so I don't know how to add this function. I want to know how many elements in bloom filter, if tow much, I need to buy a server with more memory. Guava sometimes has a error, memery not enough, use you much better and fast. Thank you.
@alexandrnikitin Can you add the approximateElementCount() function when you are free. 😊 I just want to know how many element in the filter.
@alexandrnikitin I send a PR #37 for this issue, please review it.
That's great! Thank you!
@SidWeng I've made some fixes to the code #38 PTAL
@SidWeng Thank you for your help! I've released v0.11.0, will be soon on maven. Please take a look.
Closed via #37 and #38
@alexandrnikitin v0.11.0 is still not on maven, should I wait more time or anything goes wrong?
@SidWeng I've republished it again. I see that it's on sonatype already so should be on maven soon. I'm sorry for the inconvenience.
@alexandrnikitin Already on maven, thanks a lot!
How to get the filter element size. Google guava has a method approximateElementCount() to get elements size.