Class CatalogUtil
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringShortcut catalog property to load a catalog implementation through a short type name, instead of specifying a full java class throughCatalogProperties.CATALOG_IMPL.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String
- 
Method SummaryModifier and TypeMethodDescriptionstatic CatalogBuild an IcebergCatalogbased on a map of catalog properties and optional Hadoop configuration.static voidconfigureHadoopConf(Object maybeConfigurable, Object conf) Dynamically detects whether an object is a Hadoop Configurable and calls setConf.static voiddeleteFiles(FileIO io, Iterable<String> files, String type, boolean concurrent) Helper to delete files.static voiddeleteRemovedMetadataFiles(FileIO io, TableMetadata base, TableMetadata metadata) Deletes the oldest metadata files ifTableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLEDis true.static voiddropTableData(FileIO io, TableMetadata metadata) Drops all data and metadata files referenced by TableMetadata.static voiddropViewMetadata(FileIO io, ViewMetadata metadata) Drops view metadata files referenced by ViewMetadata.static StringfullTableName(String catalogName, TableIdentifier identifier) static CatalogLoad a custom catalog implementation.static FileIOLoad a customFileIOimplementation.static FileIOloadFileIO(String impl, Map<String, String> properties, Object hadoopConf, List<StorageCredential> storageCredentials) Load a customFileIOimplementation.static MetricsReporterloadMetricsReporter(Map<String, String> properties) Load a customMetricsReporterimplementation.
- 
Field Details- 
ICEBERG_CATALOG_TYPEShortcut catalog property to load a catalog implementation through a short type name, instead of specifying a full java class throughCatalogProperties.CATALOG_IMPL. Currently the following type to implementation mappings are supported:- hive: org.apache.iceberg.hive.HiveCatalog
- hadoop: org.apache.iceberg.hadoop.HadoopCatalog
 - See Also:
 
- 
ICEBERG_CATALOG_TYPE_HADOOP- See Also:
 
- 
ICEBERG_CATALOG_TYPE_HIVE- See Also:
 
- 
ICEBERG_CATALOG_TYPE_REST- See Also:
 
- 
ICEBERG_CATALOG_TYPE_GLUE- See Also:
 
- 
ICEBERG_CATALOG_TYPE_NESSIE- See Also:
 
- 
ICEBERG_CATALOG_TYPE_JDBC- See Also:
 
- 
ICEBERG_CATALOG_TYPE_BIGQUERY- See Also:
 
- 
ICEBERG_CATALOG_HADOOP- See Also:
 
- 
ICEBERG_CATALOG_HIVE- See Also:
 
- 
ICEBERG_CATALOG_REST- See Also:
 
- 
ICEBERG_CATALOG_GLUE- See Also:
 
- 
ICEBERG_CATALOG_NESSIE- See Also:
 
- 
ICEBERG_CATALOG_JDBC- See Also:
 
- 
ICEBERG_CATALOG_BIGQUERY- See Also:
 
 
- 
- 
Method Details- 
dropTableDataDrops all data and metadata files referenced by TableMetadata.This should be called by dropTable implementations to clean up table files once the table has been dropped in the metastore. - Parameters:
- io- a FileIO to use for deletes
- metadata- the last valid TableMetadata instance for a dropped table.
 
- 
dropViewMetadataDrops view metadata files referenced by ViewMetadata.This should be called by dropView implementations - Parameters:
- io- a FileIO to use for deletes
- metadata- the last valid ViewMetadata instance for a dropped view.
 
- 
deleteFilesHelper to delete files. Bulk deletion is used if possible.- Parameters:
- io- FileIO for deletes
- files- files to delete
- type- type of files being deleted
- concurrent- controls concurrent deletion. Only applicable for non-bulk FileIO
 
- 
loadCatalogpublic static Catalog loadCatalog(String impl, String catalogName, Map<String, String> properties, Object hadoopConf) Load a custom catalog implementation.The catalog must have a no-arg constructor. If the class implements Configurable, a Hadoop config will be passed using Configurable.setConf. Catalog.initialize(String catalogName, Map options)is called to complete the initialization.- Parameters:
- impl- catalog implementation full class name
- catalogName- catalog name
- properties- catalog properties
- hadoopConf- hadoop configuration if needed
- Returns:
- initialized catalog object
- Throws:
- IllegalArgumentException- if no-arg constructor not found or error during initialization
 
- 
buildIcebergCatalogBuild an IcebergCatalogbased on a map of catalog properties and optional Hadoop configuration.This method examines both the ICEBERG_CATALOG_TYPEandCatalogProperties.CATALOG_IMPLproperties to determine the catalog implementation to load. If nothing is specified for both properties, Hive catalog will be loaded by default.- Parameters:
- name- catalog name
- options- catalog properties
- conf- a Hadoop Configuration
- Returns:
- initialized catalog
 
- 
loadFileIOLoad a customFileIOimplementation.The implementation must have a no-arg constructor. If the class implements Configurable, a Hadoop config will be passed using Configurable.setConf. FileIO.initialize(Map properties)is called to complete the initialization.- Parameters:
- impl- full class name of a custom FileIO implementation
- properties- used to initialize the FileIO implementation
- hadoopConf- a hadoop Configuration
- Returns:
- FileIO class
- Throws:
- IllegalArgumentException- if class path not found or right constructor not found or the loaded class cannot be cast to the given interface type
 
- 
loadFileIOpublic static FileIO loadFileIO(String impl, Map<String, String> properties, Object hadoopConf, List<StorageCredential> storageCredentials) Load a customFileIOimplementation.The implementation must have a no-arg constructor. If the class implements Configurable, a Hadoop config will be passed using Configurable.setConf. If the class implements SupportsStorageCredentials, the storage credentials will be passed usingSupportsStorageCredentials.setCredentials(List).FileIO.initialize(Map properties)is called to complete the initialization.- Parameters:
- impl- full class name of a custom FileIO implementation
- properties- used to initialize the FileIO implementation
- hadoopConf- a hadoop Configuration
- storageCredentials- the storage credentials to configure if the FileIO implementation implements- SupportsStorageCredentials
- Returns:
- FileIO class
- Throws:
- IllegalArgumentException- if class path not found or right constructor not found or the loaded class cannot be cast to the given interface type
 
- 
configureHadoopConfDynamically detects whether an object is a Hadoop Configurable and calls setConf.- Parameters:
- maybeConfigurable- an object that may be Configurable
- conf- a Configuration
 
- 
loadMetricsReporterLoad a customMetricsReporterimplementation.The implementation must have a no-arg constructor. - Parameters:
- properties- catalog properties which contains class name of a custom- MetricsReporterimplementation
- Returns:
- An initialized MetricsReporter.
- Throws:
- IllegalArgumentException- if class path not found or right constructor not found or the loaded class cannot be cast to the given interface type
 
- 
fullTableName
- 
deleteRemovedMetadataFilespublic static void deleteRemovedMetadataFiles(FileIO io, TableMetadata base, TableMetadata metadata) Deletes the oldest metadata files ifTableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLEDis true.- Parameters:
- io- FileIO instance to use for deletes
- base- table metadata on which previous versions were based
- metadata- new table metadata with updated previous versions
 
 
-