Skip to content
Open
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 @@ -20,6 +20,7 @@

import org.apache.paimon.fs.ByteArraySeekableStream;
import org.apache.paimon.fs.FileIO;
import org.apache.paimon.fs.SeekableInputStream;
import org.apache.paimon.fs.local.LocalFileIO;
import org.apache.paimon.io.cache.CacheManager;
import org.apache.paimon.memory.MemorySegment;
Expand Down Expand Up @@ -119,17 +120,21 @@ public void testProbe() throws IOException {
new org.apache.paimon.fs.Path(writeFile(segment.getArray()).getAbsolutePath());
FileIO fileIO = LocalFileIO.create();

CacheManager cacheManager = new CacheManager(MemorySize.ofMebiBytes(1), 0.1);
FileBasedBloomFilter filter =
new FileBasedBloomFilter(
fileIO.newInputStream(filePath), filePath, cacheManager, 100, 0, 1000);
try (SeekableInputStream input = fileIO.newInputStream(filePath);
CacheManager cacheManager = new CacheManager(MemorySize.ofMebiBytes(1), 0.1)) {
FileBasedBloomFilter filter =
new FileBasedBloomFilter(input, filePath, cacheManager, 100, 0, 1000);

Arrays.stream(inputs)
.forEach(i -> Assertions.assertThat(filter.testHash(Integer.hashCode(i))).isTrue());
filter.close();
Assertions.assertThat(cacheManager.dataCache().asMap()).isEmpty();
Assertions.assertThat(cacheManager.indexCache().asMap()).isEmpty();
Assertions.assertThat(filter.bloomFilter().getMemorySegment()).isNull();
Arrays.stream(inputs)
.forEach(
i ->
Assertions.assertThat(filter.testHash(Integer.hashCode(i)))
.isTrue());
filter.close();
Assertions.assertThat(cacheManager.dataCache().asMap()).isEmpty();
Assertions.assertThat(cacheManager.indexCache().asMap()).isEmpty();
Assertions.assertThat(filter.bloomFilter().getMemorySegment()).isNull();
}
}

@Test
Expand Down
Loading