Search in sources :

Example 1 with IcebergMetastore

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

the class TestIcebergTablesMetastoreConfigAndVersion method testLoadWithSameProperties.

@Test
public void testLoadWithSameProperties() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()).withValue(String.format(COMPONENTS_COMMON_PROPERTIES_PATTERN, TableProperties.SPLIT_SIZE), ConfigValueFactory.fromAnyRef(10)));
    Map<String, String> initialProperties = Collections.singletonMap(TableProperties.SPLIT_SIZE, "10");
    Metastore initialMetastore = new IcebergMetastore(config);
    assertEquals(initialProperties, initialMetastore.tables().metadata().properties());
    Metastore newMetastore = new IcebergMetastore(config);
    assertEquals(initialProperties, 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) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 2 with IcebergMetastore

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

the class TestIcebergTablesMetastoreConfigAndVersion method testNewInstance.

@Test
public void testNewInstance() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()));
    Metastore metastore = new IcebergMetastore(config);
    assertNotSame(metastore.tables(), metastore.tables());
}
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 3 with IcebergMetastore

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

the class TestIcebergTablesMetastoreConfigAndVersion method testLoadWithoutProperties.

@Test
public void testLoadWithoutProperties() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()));
    Metastore initialMetastore = new IcebergMetastore(config);
    assertTrue(initialMetastore.tables().metadata().properties().isEmpty());
    Metastore newMetastore = new IcebergMetastore(config);
    assertTrue(newMetastore.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 4 with IcebergMetastore

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

the class TestIcebergTablesMetastoreConfigAndVersion method testVersionUpdate.

@Test
public void testVersionUpdate() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()));
    Tables tables = new IcebergMetastore(config).tables();
    Metadata metadata = tables.metadata();
    assertTrue(metadata.supportsVersioning());
    assertEquals(0, metadata.version());
    tables.modify().overwrite(TableMetadataUnit.builder().storagePlugin("dfs").workspace("tmp").tableName("nation").metadataKey("dir0").build()).execute();
    assertNotEquals(0, metadata.version());
}
Also used : DrillConfig(org.apache.drill.common.config.DrillConfig) Metadata(org.apache.drill.metastore.operate.Metadata) Tables(org.apache.drill.metastore.components.tables.Tables) IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Test(org.junit.Test) IcebergBaseTest(org.apache.drill.metastore.iceberg.IcebergBaseTest)

Example 5 with IcebergMetastore

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

the class TestIcebergTablesMetastoreConfigAndVersion method testVersionInitial.

@Test
public void testVersionInitial() {
    DrillConfig config = new DrillConfig(baseIcebergConfig(baseLocation.getRoot()));
    Metastore metastore = new IcebergMetastore(config);
    Metadata metadata = metastore.tables().metadata();
    assertTrue(metadata.supportsVersioning());
    assertEquals(0, metadata.version());
}
Also used : IcebergMetastore(org.apache.drill.metastore.iceberg.IcebergMetastore) Metastore(org.apache.drill.metastore.Metastore) DrillConfig(org.apache.drill.common.config.DrillConfig) Metadata(org.apache.drill.metastore.operate.Metadata) 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