public class CatalogUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ICEBERG_CATALOG_GLUE |
static java.lang.String |
ICEBERG_CATALOG_HADOOP |
static java.lang.String |
ICEBERG_CATALOG_HIVE |
static java.lang.String |
ICEBERG_CATALOG_JDBC |
static java.lang.String |
ICEBERG_CATALOG_NESSIE |
static java.lang.String |
ICEBERG_CATALOG_REST |
static java.lang.String |
ICEBERG_CATALOG_TYPE
Shortcut catalog property to load a catalog implementation through a short type name, instead
of specifying a full java class through
CatalogProperties.CATALOG_IMPL . |
static java.lang.String |
ICEBERG_CATALOG_TYPE_GLUE |
static java.lang.String |
ICEBERG_CATALOG_TYPE_HADOOP |
static java.lang.String |
ICEBERG_CATALOG_TYPE_HIVE |
static java.lang.String |
ICEBERG_CATALOG_TYPE_JDBC |
static java.lang.String |
ICEBERG_CATALOG_TYPE_NESSIE |
static java.lang.String |
ICEBERG_CATALOG_TYPE_REST |
Modifier and Type | Method and Description |
---|---|
static Catalog |
buildIcebergCatalog(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> options,
java.lang.Object conf)
Build an Iceberg
Catalog based on a map of catalog properties and optional Hadoop
configuration. |
static void |
configureHadoopConf(java.lang.Object maybeConfigurable,
java.lang.Object conf)
Dynamically detects whether an object is a Hadoop Configurable and calls setConf.
|
static void |
deleteFiles(FileIO io,
java.lang.Iterable<java.lang.String> files,
java.lang.String type,
boolean concurrent)
Helper to delete files.
|
static void |
dropTableData(FileIO io,
TableMetadata metadata)
Drops all data and metadata files referenced by TableMetadata.
|
static Catalog |
loadCatalog(java.lang.String impl,
java.lang.String catalogName,
java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.Object hadoopConf)
Load a custom catalog implementation.
|
static FileIO |
loadFileIO(java.lang.String impl,
java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.Object hadoopConf)
Load a custom
FileIO implementation. |
static MetricsReporter |
loadMetricsReporter(java.util.Map<java.lang.String,java.lang.String> properties)
Load a custom
MetricsReporter implementation. |
public static final java.lang.String ICEBERG_CATALOG_TYPE
CatalogProperties.CATALOG_IMPL
. Currently the
following type to implementation mappings are supported:
public static final java.lang.String ICEBERG_CATALOG_TYPE_HADOOP
public static final java.lang.String ICEBERG_CATALOG_TYPE_HIVE
public static final java.lang.String ICEBERG_CATALOG_TYPE_REST
public static final java.lang.String ICEBERG_CATALOG_TYPE_GLUE
public static final java.lang.String ICEBERG_CATALOG_TYPE_NESSIE
public static final java.lang.String ICEBERG_CATALOG_TYPE_JDBC
public static final java.lang.String ICEBERG_CATALOG_HADOOP
public static final java.lang.String ICEBERG_CATALOG_HIVE
public static final java.lang.String ICEBERG_CATALOG_REST
public static final java.lang.String ICEBERG_CATALOG_GLUE
public static final java.lang.String ICEBERG_CATALOG_NESSIE
public static final java.lang.String ICEBERG_CATALOG_JDBC
public static void dropTableData(FileIO io, TableMetadata metadata)
This should be called by dropTable implementations to clean up table files once the table has been dropped in the metastore.
io
- a FileIO to use for deletesmetadata
- the last valid TableMetadata instance for a dropped table.public static void deleteFiles(FileIO io, java.lang.Iterable<java.lang.String> files, java.lang.String type, boolean concurrent)
io
- FileIO for deletesfiles
- files to deletetype
- type of files being deletedconcurrent
- controls concurrent deletion. Only applicable for non-bulk FileIOpublic static Catalog loadCatalog(java.lang.String impl, java.lang.String catalogName, java.util.Map<java.lang.String,java.lang.String> properties, java.lang.Object hadoopConf)
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.
impl
- catalog implementation full class namecatalogName
- catalog nameproperties
- catalog propertieshadoopConf
- hadoop configuration if neededjava.lang.IllegalArgumentException
- if no-arg constructor not found or error during initializationpublic static Catalog buildIcebergCatalog(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> options, java.lang.Object conf)
Catalog
based on a map of catalog properties and optional Hadoop
configuration.
This method examines both the ICEBERG_CATALOG_TYPE
and CatalogProperties.CATALOG_IMPL
properties to determine the catalog implementation to load. If
nothing is specified for both properties, Hive catalog will be loaded by default.
name
- catalog nameoptions
- catalog propertiesconf
- a Hadoop Configurationpublic static FileIO loadFileIO(java.lang.String impl, java.util.Map<java.lang.String,java.lang.String> properties, java.lang.Object hadoopConf)
FileIO
implementation.
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.
impl
- full class name of a custom FileIO implementationproperties
- used to initialize the FileIO implementationhadoopConf
- a hadoop Configurationjava.lang.IllegalArgumentException
- if class path not found or right constructor not found or the
loaded class cannot be cast to the given interface typepublic static void configureHadoopConf(java.lang.Object maybeConfigurable, java.lang.Object conf)
maybeConfigurable
- an object that may be Configurableconf
- a Configurationpublic static MetricsReporter loadMetricsReporter(java.util.Map<java.lang.String,java.lang.String> properties)
MetricsReporter
implementation.
The implementation must have a no-arg constructor.
properties
- catalog properties which contains class name of a custom MetricsReporter
implementationMetricsReporter
.java.lang.IllegalArgumentException
- if class path not found or right constructor not found or the
loaded class cannot be cast to the given interface type