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());
}
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();
}
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());
}
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());
}
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());
}
Aggregations