Search in sources :

Example 1 with BloomIndex

use of io.hetu.core.plugin.heuristicindex.index.bloom.BloomIndex in project hetu-core by openlookeng.

the class TestHeuristicIndexFilter method setup.

@BeforeClass
public void setup() throws IOException {
    try (TempFolder folder = new TempFolder()) {
        folder.create();
        File testFile = folder.newFile();
        bloomIndex1 = new BloomIndex();
        bloomIndex1.setExpectedNumOfEntries(2);
        bloomIndex1.addValues(Collections.singletonList(new Pair<>("testColumn", ImmutableList.of("a", "b"))));
        try (FileOutputStream fo = new FileOutputStream(testFile)) {
            bloomIndex1.serialize(fo);
        }
        try (FileInputStream fi = new FileInputStream(testFile)) {
            bloomIndex1.deserialize(fi);
        }
        bloomIndex2 = new BloomIndex();
        bloomIndex2.setExpectedNumOfEntries(2);
        bloomIndex2.addValues(Collections.singletonList(new Pair<>("testColumn", ImmutableList.of("c", "d"))));
        try (FileOutputStream fo = new FileOutputStream(testFile)) {
            bloomIndex2.serialize(fo);
        }
        try (FileInputStream fi = new FileInputStream(testFile)) {
            bloomIndex2.deserialize(fi);
        }
        minMaxIndex1 = new MinMaxIndex();
        minMaxIndex1.addValues(Collections.singletonList(new Pair<>("testColumn", ImmutableList.of(1L, 5L, 10L))));
        minMaxIndex2 = new MinMaxIndex();
        minMaxIndex2.addValues(Collections.singletonList(new Pair<>("testColumn", ImmutableList.of(50L, 80L, 100L))));
    }
}
Also used : BloomIndex(io.hetu.core.plugin.heuristicindex.index.bloom.BloomIndex) MinMaxIndex(io.hetu.core.plugin.heuristicindex.index.minmax.MinMaxIndex) TempFolder(io.hetu.core.common.filesystem.TempFolder) FileOutputStream(java.io.FileOutputStream) File(java.io.File) FileInputStream(java.io.FileInputStream) Pair(io.prestosql.spi.heuristicindex.Pair) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

TempFolder (io.hetu.core.common.filesystem.TempFolder)1 BloomIndex (io.hetu.core.plugin.heuristicindex.index.bloom.BloomIndex)1 MinMaxIndex (io.hetu.core.plugin.heuristicindex.index.minmax.MinMaxIndex)1 Pair (io.prestosql.spi.heuristicindex.Pair)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 BeforeClass (org.testng.annotations.BeforeClass)1