Search in sources :

Example 6 with IcebergMetastore

use of org.apache.drill.metastore.iceberg.IcebergMetastore in project drill by apache.

the class TestTablesOperationTransformer method init.

@BeforeClass
public static void init() throws Exception {
    location = new Path(defaultFolder.newFolder(TestTablesOperationTransformer.class.getSimpleName()).toURI().getPath()).toUri().getPath();
    IcebergMetastore metastore = new IcebergMetastore(new DrillConfig(baseIcebergConfig(new File(location))));
    transformer = new TablesOperationTransformer((IcebergTables) metastore.tables());
}
Also used : Path(org.apache.hadoop.fs.Path) DrillConfig(org.apache.drill.common.config.DrillConfig) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 7 with IcebergMetastore

use of org.apache.drill.metastore.iceberg.IcebergMetastore in project drill by apache.

the class TestExpirationHandler method tables.

private IcebergTables tables(String name, boolean shouldExpire, int retainNumber) {
    Config config = baseIcebergConfig(new File(defaultFolder.getRoot(), name)).withValue(IcebergConfigConstants.COMPONENTS_COMMON_PROPERTIES + "." + TableProperties.METADATA_PREVIOUS_VERSIONS_MAX, ConfigValueFactory.fromAnyRef(retainNumber)).withValue(IcebergConfigConstants.COMPONENTS_COMMON_PROPERTIES + "." + TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED, ConfigValueFactory.fromAnyRef(shouldExpire));
    DrillConfig drillConfig = new DrillConfig(config);
    return (IcebergTables) new IcebergMetastore(drillConfig).tables();
}
Also used : IcebergTables(org.apache.drill.metastore.iceberg.components.tables.IcebergTables) DrillConfig(org.apache.drill.common.config.DrillConfig) Config(com.typesafe.config.Config) DrillConfig(org.apache.drill.common.config.DrillConfig) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) File(java.io.File)

Example 8 with IcebergMetastore

use of org.apache.drill.metastore.iceberg.IcebergMetastore in project drill by apache.

the class TestIcebergTablesMetastoreConfigAndVersion method testCreationWithoutProperties.

@Test
public void testCreationWithoutProperties() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()));
    Metastore metastore = new IcebergMetastore(config);
    assertTrue(metastore.tables().metadata().properties().isEmpty());
}
Also used : IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Metastore(org.apache.drill.metastore.Metastore) DrillConfig(org.apache.drill.common.config.DrillConfig) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 9 with IcebergMetastore

use of org.apache.drill.metastore.iceberg.IcebergMetastore in project drill by apache.

the class TestIcebergTablesMetastoreConfigAndVersion method testLoadWithUpdatedProperties.

@Test
public void testLoadWithUpdatedProperties() {
    DrillConfig initialConfig = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()).withValue(String.format(COMPONENTS_COMMON_PROPERTIES_PATTERN, TableProperties.SPLIT_SIZE), ConfigValueFactory.fromAnyRef(10)).withValue(String.format(COMPONENTS_TABLES_PROPERTIES_PATTERN, TableProperties.MANIFEST_MIN_MERGE_COUNT), ConfigValueFactory.fromAnyRef(2)));
    Map<String, String> initialProperties = new HashMap<>();
    initialProperties.put(TableProperties.SPLIT_SIZE, "10");
    initialProperties.put(TableProperties.MANIFEST_MIN_MERGE_COUNT, "2");
    Metastore initialMetastore = new IcebergMetastore(initialConfig);
    assertEquals(initialProperties, initialMetastore.tables().metadata().properties());
    DrillConfig newConfig = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()).withValue(String.format(COMPONENTS_COMMON_PROPERTIES_PATTERN, TableProperties.SPLIT_SIZE), ConfigValueFactory.fromAnyRef(100)).withValue(String.format(COMPONENTS_TABLES_PROPERTIES_PATTERN, TableProperties.COMMIT_NUM_RETRIES), ConfigValueFactory.fromAnyRef(5)));
    Map<String, String> newProperties = new HashMap<>();
    newProperties.put(TableProperties.SPLIT_SIZE, "100");
    newProperties.put(TableProperties.COMMIT_NUM_RETRIES, "5");
    Metastore newMetastore = new IcebergMetastore(newConfig);
    assertEquals(newProperties, newMetastore.tables().metadata().properties());
}
Also used : IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Metastore(org.apache.drill.metastore.Metastore) DrillConfig(org.apache.drill.common.config.DrillConfig) HashMap(java.util.HashMap) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 10 with IcebergMetastore

use of org.apache.drill.metastore.iceberg.IcebergMetastore in project drill by apache.

the class TestIcebergTablesMetastoreConfigAndVersion method testCreationWithCommonProperties.

@Test
public void testCreationWithCommonProperties() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()).withValue(String.format(COMPONENTS_COMMON_PROPERTIES_PATTERN, TableProperties.SPLIT_SIZE), ConfigValueFactory.fromAnyRef(10)).withValue(String.format(COMPONENTS_COMMON_PROPERTIES_PATTERN, TableProperties.MANIFEST_MIN_MERGE_COUNT), ConfigValueFactory.fromAnyRef(2)));
    Metastore metastore = new IcebergMetastore(config);
    Map<String, String> expected = new HashMap<>();
    expected.put(TableProperties.SPLIT_SIZE, "10");
    expected.put(TableProperties.MANIFEST_MIN_MERGE_COUNT, "2");
    assertEquals(expected, metastore.tables().metadata().properties());
}
Also used : IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Metastore(org.apache.drill.metastore.Metastore) DrillConfig(org.apache.drill.common.config.DrillConfig) HashMap(java.util.HashMap) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Aggregations

DrillConfig (org.apache.drill.common.config.DrillConfig)12 IcebergMetastore (org.apache.drill.metastore.iceberg.IcebergMetastore)12 IcebergBaseTest (org.apache.drill.metastore.iceberg.IcebergBaseTest)10 Test (org.junit.Test)10 Metastore (org.apache.drill.metastore.Metastore)9 HashMap (java.util.HashMap)3 File (java.io.File)2 Metadata (org.apache.drill.metastore.operate.Metadata)2 Config (com.typesafe.config.Config)1 Tables (org.apache.drill.metastore.components.tables.Tables)1 IcebergTables (org.apache.drill.metastore.iceberg.components.tables.IcebergTables)1 Path (org.apache.hadoop.fs.Path)1 BeforeClass (org.junit.BeforeClass)1