public class HiveCatalog extends AbstractCatalog
Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException, Catalog.DatabaseAlreadyExistException, Catalog.DatabaseNotEmptyException, Catalog.DatabaseNotExistException, Catalog.Loader, Catalog.PartitionNotExistException, Catalog.ProcessSystemDatabaseException, Catalog.TableAlreadyExistException, Catalog.TableNotExistException
Modifier and Type | Field and Description |
---|---|
static String |
HIVE_SITE_FILE |
static String |
PAIMON_TABLE_TYPE_VALUE |
static String |
TABLE_TYPE_PROP |
catalogOptions, fileIO, lineageMetaFactory, tableDefaultOptions
COMMENT_PROP, DB_LOCATION_PROP, DB_SUFFIX, DEFAULT_DATABASE, SYSTEM_BRANCH_PREFIX, SYSTEM_DATABASE_NAME, SYSTEM_TABLE_SPLITTER, TABLE_DEFAULT_OPTION_PREFIX
Constructor and Description |
---|
HiveCatalog(FileIO fileIO,
org.apache.hadoop.hive.conf.HiveConf hiveConf,
String clientClassName,
Options options,
String warehouse) |
HiveCatalog(FileIO fileIO,
org.apache.hadoop.hive.conf.HiveConf hiveConf,
String clientClassName,
String warehouse) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowUpperCase()
Return a boolean that indicates whether this catalog allow upper case.
|
protected void |
alterTableImpl(Identifier identifier,
List<SchemaChange> changes) |
void |
close() |
protected void |
createDatabaseImpl(String name,
Map<String,String> properties) |
static Catalog |
createHiveCatalog(CatalogContext context) |
static org.apache.hadoop.hive.conf.HiveConf |
createHiveConf(CatalogContext context) |
static org.apache.hadoop.hive.conf.HiveConf |
createHiveConf(String hiveConfDir,
String hadoopConfDir,
org.apache.hadoop.conf.Configuration defaultHadoopConf) |
protected void |
createTableImpl(Identifier identifier,
Schema schema) |
Optional<CatalogLockFactory> |
defaultLockFactory() |
protected void |
dropDatabaseImpl(String name) |
void |
dropPartition(Identifier identifier,
Map<String,String> partitionSpec)
Drop the partition of the specify table.
|
protected void |
dropTableImpl(Identifier identifier) |
TableSchema |
getDataTableSchema(Identifier identifier) |
FormatTable |
getFormatTable(Identifier identifier)
Return a
FormatTable identified by the given Identifier . |
static org.apache.hadoop.conf.Configuration |
getHadoopConfiguration(String hadoopConfDir)
Returns a new Hadoop Configuration object using the path to the hadoop conf configured.
|
org.apache.hadoop.hive.metastore.IMetaStoreClient |
getHmsClient() |
Path |
getTableLocation(Identifier identifier)
Get the table location in this catalog.
|
List<String> |
listDatabases()
Get the names of all databases in this catalog.
|
protected List<String> |
listTablesImpl(String databaseName) |
Map<String,String> |
loadDatabasePropertiesImpl(String name) |
Optional<CatalogLockContext> |
lockContext()
Get lock context for lock factory to create a lock.
|
Optional<MetastoreClient.Factory> |
metastoreClientFactory(Identifier identifier)
Get metastore client factory for the table specified by
identifier . |
static String |
possibleHiveConfPath() |
protected void |
renameTableImpl(Identifier fromTable,
Identifier toTable) |
void |
repairCatalog() |
void |
repairDatabase(String databaseName) |
void |
repairTable(Identifier identifier) |
boolean |
syncAllProperties() |
boolean |
tableExists(Identifier identifier)
Check if a table exists in this catalog.
|
String |
warehouse()
Warehouse root path containing all database directories in this catalog.
|
allTablePaths, alterTable, assertMainBranch, checkNotBranch, checkNotSystemDatabase, checkNotSystemTable, createDatabase, createTable, dropDatabase, dropTable, fileIO, getTable, isSpecifiedSystemTable, isSystemDatabase, isSystemTable, listDatabasesInFileSystem, listTables, listTablesInFileSystem, loadDatabaseProperties, lockEnabled, lockFactory, newDatabasePath, newDatabasePath, newTableLocation, options, renameTable, tableExistsInFileSystem, tableSchemaInFileSystem, validateFieldNameCaseInsensitive, validateIdentifierNameCaseInsensitive
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
alterTable, createDatabase, databaseExists, invalidateTable, tableDefaultOptions, validateCaseInsensitive, validateCaseInsensitive
public static final String TABLE_TYPE_PROP
public static final String PAIMON_TABLE_TYPE_VALUE
public static final String HIVE_SITE_FILE
public HiveCatalog(FileIO fileIO, org.apache.hadoop.hive.conf.HiveConf hiveConf, String clientClassName, String warehouse)
public Optional<CatalogLockFactory> defaultLockFactory()
defaultLockFactory
in class AbstractCatalog
public Optional<CatalogLockContext> lockContext()
Catalog
lockContext
in interface Catalog
lockContext
in class AbstractCatalog
public Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier)
Catalog
identifier
.public Path getTableLocation(Identifier identifier)
Catalog
getTableLocation
in interface Catalog
getTableLocation
in class AbstractCatalog
public List<String> listDatabases()
Catalog
protected void createDatabaseImpl(String name, Map<String,String> properties)
createDatabaseImpl
in class AbstractCatalog
public Map<String,String> loadDatabasePropertiesImpl(String name) throws Catalog.DatabaseNotExistException
loadDatabasePropertiesImpl
in class AbstractCatalog
Catalog.DatabaseNotExistException
public void dropPartition(Identifier identifier, Map<String,String> partitionSpec) throws Catalog.TableNotExistException
Catalog
dropPartition
in interface Catalog
dropPartition
in class AbstractCatalog
identifier
- path of the table to drop partitionpartitionSpec
- the partition to be deletedCatalog.TableNotExistException
- if the table does not existprotected void dropDatabaseImpl(String name)
dropDatabaseImpl
in class AbstractCatalog
protected List<String> listTablesImpl(String databaseName)
listTablesImpl
in class AbstractCatalog
public boolean tableExists(Identifier identifier)
Catalog
identifier
- Path of the tablepublic TableSchema getDataTableSchema(Identifier identifier) throws Catalog.TableNotExistException
getDataTableSchema
in class AbstractCatalog
Catalog.TableNotExistException
public FormatTable getFormatTable(Identifier identifier) throws Catalog.TableNotExistException
AbstractCatalog
FormatTable
identified by the given Identifier
.getFormatTable
in class AbstractCatalog
identifier
- Path of the tableCatalog.TableNotExistException
- if the target does not existprotected void dropTableImpl(Identifier identifier)
dropTableImpl
in class AbstractCatalog
protected void createTableImpl(Identifier identifier, Schema schema)
createTableImpl
in class AbstractCatalog
protected void renameTableImpl(Identifier fromTable, Identifier toTable)
renameTableImpl
in class AbstractCatalog
protected void alterTableImpl(Identifier identifier, List<SchemaChange> changes) throws Catalog.TableNotExistException, Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException
alterTableImpl
in class AbstractCatalog
Catalog.TableNotExistException
Catalog.ColumnAlreadyExistException
Catalog.ColumnNotExistException
public boolean allowUpperCase()
Catalog
allowUpperCase
in interface Catalog
allowUpperCase
in class AbstractCatalog
public boolean syncAllProperties()
public void repairCatalog()
public void repairDatabase(String databaseName)
public void repairTable(Identifier identifier) throws Catalog.TableNotExistException
Catalog.TableNotExistException
public String warehouse()
Catalog
@VisibleForTesting public org.apache.hadoop.hive.metastore.IMetaStoreClient getHmsClient()
public static org.apache.hadoop.hive.conf.HiveConf createHiveConf(@Nullable String hiveConfDir, @Nullable String hadoopConfDir, org.apache.hadoop.conf.Configuration defaultHadoopConf)
public static Catalog createHiveCatalog(CatalogContext context)
public static org.apache.hadoop.hive.conf.HiveConf createHiveConf(CatalogContext context)
public static org.apache.hadoop.conf.Configuration getHadoopConfiguration(String hadoopConfDir)
hadoopConfDir
- Hadoop conf directory path.public static String possibleHiveConfPath()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.