use of org.apache.drill.metastore.iceberg.components.tables.IcebergTables in project drill by apache.
the class TestExpirationHandler method testNoExpiration.
@Test
public void testNoExpiration() {
IcebergTables tables = tables("no-expiration", false, 2);
// check that there is no history
assertEquals(0, tables.table().history().size());
int operationsNumber = 5;
execute(tables, operationsNumber);
// check that the number of executed operations is same as number of history records
assertEquals(operationsNumber, tables.table().history().size());
}
use of org.apache.drill.metastore.iceberg.components.tables.IcebergTables 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.components.tables.IcebergTables in project drill by apache.
the class TestExpirationHandler method testSubsequentExpiration.
@Test
public void testSubsequentExpiration() {
String name = "subsequent-expiration";
int retainNumber = 2;
int operationsNumber = 5;
IcebergTables initialTables = tables(name, false, retainNumber);
execute(initialTables, operationsNumber);
// check that number of executed operations is the same as number of history records
assertEquals(operationsNumber, initialTables.table().history().size());
// update table configuration, allow expiration
IcebergTables updatedTables = tables(name, true, retainNumber);
// check that number of history operation did not change
assertEquals(operationsNumber, updatedTables.table().history().size());
execute(updatedTables, operationsNumber);
// check that number of history records corresponds to the expected retain number
assertEquals(retainNumber, updatedTables.table().history().size());
}
use of org.apache.drill.metastore.iceberg.components.tables.IcebergTables in project drill by apache.
the class TestExpirationHandler method testExpiration.
@Test
public void testExpiration() {
int retainNumber = 3;
IcebergTables tables = tables("expiration", true, retainNumber);
// check that there is no history
assertEquals(0, tables.table().history().size());
execute(tables, 5);
// check that number of history records corresponds to the expected retain number
assertEquals(retainNumber, tables.table().history().size());
}
Aggregations