Search in sources :

Example 1 with CloseableGroup

use of org.apache.iceberg.io.CloseableGroup in project iceberg by apache.

the class DynamoDbCatalog method initialize.

@VisibleForTesting
void initialize(String name, String path, AwsProperties properties, DynamoDbClient client, FileIO io) {
    this.catalogName = name;
    this.awsProperties = properties;
    this.warehousePath = cleanWarehousePath(path);
    this.dynamo = client;
    this.fileIO = io;
    this.closeableGroup = new CloseableGroup();
    closeableGroup.addCloseable(dynamo);
    closeableGroup.addCloseable(fileIO);
    closeableGroup.setSuppressCloseFailure(true);
    ensureCatalogTableExistsOrCreate();
}
Also used : CloseableGroup(org.apache.iceberg.io.CloseableGroup) VisibleForTesting(org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting)

Example 2 with CloseableGroup

use of org.apache.iceberg.io.CloseableGroup in project iceberg by apache.

the class GlueCatalog method initialize.

@VisibleForTesting
void initialize(String name, String path, AwsProperties properties, GlueClient client, LockManager lock, FileIO io) {
    this.catalogName = name;
    this.awsProperties = properties;
    this.warehousePath = cleanWarehousePath(path);
    this.glue = client;
    this.lockManager = lock;
    this.fileIO = io;
    this.closeableGroup = new CloseableGroup();
    closeableGroup.addCloseable(glue);
    closeableGroup.addCloseable(lockManager);
    closeableGroup.addCloseable(fileIO);
    closeableGroup.setSuppressCloseFailure(true);
}
Also used : CloseableGroup(org.apache.iceberg.io.CloseableGroup) VisibleForTesting(org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting)

Example 3 with CloseableGroup

use of org.apache.iceberg.io.CloseableGroup in project iceberg by apache.

the class HadoopCatalog method initialize.

@Override
public void initialize(String name, Map<String, String> properties) {
    String inputWarehouseLocation = properties.get(CatalogProperties.WAREHOUSE_LOCATION);
    Preconditions.checkArgument(inputWarehouseLocation != null && !inputWarehouseLocation.equals(""), "Cannot instantiate hadoop catalog. No location provided for warehouse (Set warehouse config)");
    this.catalogName = name;
    this.warehouseLocation = inputWarehouseLocation.replaceAll("/*$", "");
    this.fs = Util.getFs(new Path(warehouseLocation), conf);
    String fileIOImpl = properties.get(CatalogProperties.FILE_IO_IMPL);
    this.fileIO = fileIOImpl == null ? new HadoopFileIO(conf) : CatalogUtil.loadFileIO(fileIOImpl, properties, conf);
    this.lockManager = LockManagers.from(properties);
    this.closeableGroup = new CloseableGroup();
    closeableGroup.addCloseable(lockManager);
    closeableGroup.setSuppressCloseFailure(true);
    this.suppressPermissionError = Boolean.parseBoolean(properties.get(HADOOP_SUPPRESS_PERMISSION_ERROR));
}
Also used : Path(org.apache.hadoop.fs.Path) CloseableGroup(org.apache.iceberg.io.CloseableGroup)

Aggregations

CloseableGroup (org.apache.iceberg.io.CloseableGroup)3 VisibleForTesting (org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting)2 Path (org.apache.hadoop.fs.Path)1