Search in sources :

Example 1 with SparkHoodieHBaseIndex

use of org.apache.hudi.index.hbase.SparkHoodieHBaseIndex in project hudi by apache.

the class TestHoodieIndexConfigs method testCreateIndex.

@ParameterizedTest
@EnumSource(value = IndexType.class, names = { "BLOOM", "GLOBAL_BLOOM", "SIMPLE", "GLOBAL_SIMPLE", "HBASE", "BUCKET" })
public void testCreateIndex(IndexType indexType) {
    HoodieWriteConfig config;
    HoodieWriteConfig.Builder clientConfigBuilder = HoodieWriteConfig.newBuilder();
    HoodieIndexConfig.Builder indexConfigBuilder = HoodieIndexConfig.newBuilder();
    switch(indexType) {
        case INMEMORY:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(HoodieIndex.IndexType.INMEMORY).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof HoodieInMemoryHashIndex);
            break;
        case BLOOM:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(HoodieIndex.IndexType.BLOOM).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof HoodieBloomIndex);
            break;
        case GLOBAL_BLOOM:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(IndexType.GLOBAL_BLOOM).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof HoodieGlobalBloomIndex);
            break;
        case SIMPLE:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(IndexType.SIMPLE).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof HoodieSimpleIndex);
            break;
        case HBASE:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(HoodieIndex.IndexType.HBASE).withHBaseIndexConfig(new HoodieHBaseIndexConfig.Builder().build()).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof SparkHoodieHBaseIndex);
            break;
        case BUCKET:
            config = clientConfigBuilder.withPath(basePath).withIndexConfig(indexConfigBuilder.withIndexType(IndexType.BUCKET).build()).build();
            assertTrue(SparkHoodieIndexFactory.createIndex(config) instanceof HoodieBucketIndex);
            break;
        default:
    }
}
Also used : HoodieBloomIndex(org.apache.hudi.index.bloom.HoodieBloomIndex) HoodieInMemoryHashIndex(org.apache.hudi.index.inmemory.HoodieInMemoryHashIndex) HoodieSimpleIndex(org.apache.hudi.index.simple.HoodieSimpleIndex) HoodieWriteConfig(org.apache.hudi.config.HoodieWriteConfig) HoodieGlobalBloomIndex(org.apache.hudi.index.bloom.HoodieGlobalBloomIndex) HoodieBucketIndex(org.apache.hudi.index.bucket.HoodieBucketIndex) HoodieIndexConfig(org.apache.hudi.config.HoodieIndexConfig) SparkHoodieHBaseIndex(org.apache.hudi.index.hbase.SparkHoodieHBaseIndex) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

HoodieIndexConfig (org.apache.hudi.config.HoodieIndexConfig)1 HoodieWriteConfig (org.apache.hudi.config.HoodieWriteConfig)1 HoodieBloomIndex (org.apache.hudi.index.bloom.HoodieBloomIndex)1 HoodieGlobalBloomIndex (org.apache.hudi.index.bloom.HoodieGlobalBloomIndex)1 HoodieBucketIndex (org.apache.hudi.index.bucket.HoodieBucketIndex)1 SparkHoodieHBaseIndex (org.apache.hudi.index.hbase.SparkHoodieHBaseIndex)1 HoodieInMemoryHashIndex (org.apache.hudi.index.inmemory.HoodieInMemoryHashIndex)1 HoodieSimpleIndex (org.apache.hudi.index.simple.HoodieSimpleIndex)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1