Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -125,6 +125,6 @@ private BloomFilter.Builder createBloomFiler(boolean enabled) {
if (!enabled) {
return null;
}
return BloomFilter.builder(100, 0.01);
return BloomFilter.builder(5000000, 0.01);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,25 @@ public static List<List<Object>> getVarSeg() {
return getCountBloomList();
}

/** Query data based on some keys that are definitely stored. */
@TestTemplate
void testLookupReader() throws IOException {
readLookupDataBenchmark(
generateSequenceInputs(0, recordCount),
generateRandomInputs(0, recordCount, QUERY_KEY_COUNT));
generateRandomInputs(0, recordCount, QUERY_KEY_COUNT),
false);
}

private void readLookupDataBenchmark(byte[][] inputs, byte[][] randomInputs)
/** Query data based on some keys that are definitely not stored. */
@TestTemplate
void testLookupReaderMiss() throws IOException {
readLookupDataBenchmark(
generateSequenceInputs(0, recordCount),
generateRandomInputs(recordCount + 1, recordCount * 2, QUERY_KEY_COUNT),
true);
}

private void readLookupDataBenchmark(byte[][] inputs, byte[][] randomInputs, boolean nullResult)
throws IOException {
Benchmark benchmark =
new Benchmark("reader-" + randomInputs.length, randomInputs.length)
Expand All @@ -91,7 +102,12 @@ private void readLookupDataBenchmark(byte[][] inputs, byte[][] randomInputs)
5,
() -> {
try {
readData(options, randomInputs, pair.getLeft(), pair.getRight());
readData(
options,
randomInputs,
pair.getLeft(),
pair.getRight(),
nullResult);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -106,7 +122,8 @@ private void readData(
CoreOptions options,
byte[][] randomInputs,
String filePath,
LookupStoreFactory.Context context)
LookupStoreFactory.Context context,
boolean nullResult)
throws IOException {
LookupStoreFactory factory =
LookupStoreFactory.create(
Expand All @@ -118,7 +135,11 @@ private void readData(
File file = new File(filePath);
LookupStoreReader reader = factory.createReader(file, context);
for (byte[] input : randomInputs) {
assertThat(reader.lookup(input)).isNotNull();
if (nullResult) {
assertThat(reader.lookup(input)).isNull();
} else {
assertThat(reader.lookup(input)).isNotNull();
}
}
reader.close();
}
Expand Down