Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PARQUET-41: Add bloom filter #757

Merged
merged 18 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.Arrays;

/*
* This Bloom filter is implemented using block-based Bloom filter algorithm from Putze et al.'s
Expand Down Expand Up @@ -223,8 +222,6 @@ public void writeTo(OutputStream out) throws IOException {
}

private int[] setMask(int key) {
Arrays.fill(mask, 0);

// The following three loops are written separately so that they could be
// optimized for vectorization.
for (int i = 0; i < BITS_SET_PER_BLOCK; ++i) {
gszadovszky marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -316,7 +313,6 @@ public long hash(Object value) {
return hashFunction.hashBytes(((Binary) value).getBytes());
}

cacheBuffer.clear();
if (value instanceof Integer) {
gszadovszky marked this conversation as resolved.
Show resolved Hide resolved
cacheBuffer.putInt((Integer)value);
} else if (value instanceof Long) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ public void testBloomFilterForPrimitives() {
}

private void testBloomFilterForPrimitives(long seed) {
Random random = new Random(seed);
final int numValues = 1024 * 1024;
final int numBytes = BlockSplitBloomFilter.optimalNumOfBits(numValues , 0.01) / 8;

final int numBytes = BlockSplitBloomFilter.optimalNumOfBits(numValues , random.nextDouble()/10) / 8;
gszadovszky marked this conversation as resolved.
Show resolved Hide resolved
BloomFilter bloomFilter = new BlockSplitBloomFilter(numBytes);
Random random = new Random(seed);

Set<Object> values = new HashSet<>();

for (int i = 0; i < numValues; i++) {
Expand Down