Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
leaves12138 committed Apr 3, 2024
1 parent 4316d64 commit 2c95069
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
/** Bloom filter 64 handle 64 bit hash. */
public class BloomFilter64 {

private java.util.BitSet bitSet;
private BitSet bitSet;
private int numBits;
private int numHashFunctions;

public BloomFilter64(long items, double fpp) {
this.numBits = (int) (-items * Math.log(fpp) / (Math.log(2) * Math.log(2)));
this.numHashFunctions =
Math.max(1, (int) Math.round((double) numBits / items * Math.log(2)));
this.bitSet = new java.util.BitSet(numBits);
this.bitSet = new BitSet(numBits);
}

public void addHash(long hash64) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.paimon.utils;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.RepeatedTest;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -30,7 +30,7 @@ public class BloomFilter64Test {

private static final Random RANDOM = new Random();

@Test
@RepeatedTest(10000)
public void testFunction() {
BloomFilter64 bloomFilter64 = new BloomFilter64(10000, 0.02);

Expand All @@ -55,6 +55,6 @@ public void testFunction() {
}

// ffp should be less than 0.021
Assertions.assertThat((double) errorCount / num).isLessThan(0.021);
Assertions.assertThat((double) errorCount / num).isLessThan(0.03);
}
}

0 comments on commit 2c95069

Please sign in to comment.