public static <T extends HoodieRecordPayload> HoodieIndex<T> createIndex(HoodieWriteConfig config, JavaSparkContext jsc) throws HoodieIndexException { switch (config.getIndexType()) { case HBASE: return new HBaseIndex<>(config); case INMEMORY: return new InMemoryHashIndex<>(config); case BLOOM: return new HoodieBloomIndex<>(config); case GLOBAL_BLOOM: return new HoodieGlobalBloomIndex<>(config); case BUCKETED: return new BucketedIndex<>(config); default: throw new HoodieIndexException("Index type unspecified, set " + config.getIndexType()); } }
if (shouldCompareWithFile(indexInfo._2(), recordKey)) { recordComparisons.add( new Tuple2<>(String.format("%s#%s", indexInfo._2().getFileName(), recordKey),
HoodieGlobalBloomIndex index = new HoodieGlobalBloomIndex(config); new Tuple2<>("2017/10/23", "004"))).mapToPair(t -> t); List<Tuple2<String, Tuple2<String, HoodieKey>>> comparisonKeyList = index.explodeRecordRDDWithFileComparisons( partitionToFileIndexInfo, partitionRecordKeyPairRDD).collect();
@Test public void testLoadInvolvedFiles() throws IOException { HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(basePath).build(); HoodieGlobalBloomIndex index = new HoodieGlobalBloomIndex(config); HoodieTable table = HoodieTable.getHoodieTable(metadata, config, jsc); List<Tuple2<String, BloomIndexFileInfo>> filesList = index.loadInvolvedFiles(partitions, jsc, table); filesList = index.loadInvolvedFiles(partitions, jsc, table); assertEquals(filesList.size(), 4);
@Test public void testTagLocation() throws Exception { HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(basePath).build(); HoodieGlobalBloomIndex index = new HoodieGlobalBloomIndex(config); JavaRDD<HoodieRecord> taggedRecordRDD = index.tagLocation(recordRDD, jsc, table);