public class HiveCatalog extends AbstractCatalog
AbstractCatalog.TableMeta
Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException, Catalog.DatabaseAlreadyExistException, Catalog.DatabaseNotEmptyException, Catalog.DatabaseNotExistException, Catalog.Loader, Catalog.PartitionNotExistException, Catalog.ProcessSystemDatabaseException, Catalog.TableAlreadyExistException, Catalog.TableNotExistException, Catalog.ViewAlreadyExistException, Catalog.ViewNotExistException
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, HIVE_LAST_UPDATE_TIME_PROP, LAST_UPDATE_TIME_PROP, NUM_FILES_PROP, NUM_ROWS_PROP, OWNER_PROP, SYSTEM_BRANCH_PREFIX, SYSTEM_DATABASE_NAME, SYSTEM_TABLE_SPLITTER, TABLE_DEFAULT_OPTION_PREFIX, TOTAL_SIZE_PROP
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 |
---|---|
protected boolean |
allowCustomTablePath() |
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) |
void |
createFormatTable(Identifier identifier,
Schema schema)
Create a
FormatTable identified by the given Identifier . |
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) |
void |
createView(Identifier identifier,
View view,
boolean ignoreIfExists)
Create a new view.
|
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) |
void |
dropView(Identifier identifier,
boolean ignoreIfNotExists)
Drop a view.
|
Database |
getDatabaseImpl(String name) |
Table |
getDataOrFormatTable(Identifier identifier) |
protected AbstractCatalog.TableMeta |
getDataTableMeta(Identifier identifier) |
TableSchema |
getDataTableSchema(Identifier identifier) |
org.apache.hadoop.hive.metastore.IMetaStoreClient |
getHmsClient() |
org.apache.hadoop.hive.metastore.api.Table |
getHmsTable(Identifier identifier) |
Path |
getTableLocation(Identifier identifier)
Get the table location in this catalog.
|
View |
getView(Identifier identifier)
Return a
View identified by the given Identifier . |
static boolean |
isView(org.apache.hadoop.hive.metastore.api.Table table) |
List<String> |
listDatabases()
Get the names of all databases in this catalog.
|
protected List<String> |
listTablesImpl(String databaseName) |
List<String> |
listViews(String databaseName)
Get names of all views under this database.
|
Optional<CatalogLockContext> |
lockContext() |
Optional<MetastoreClient.Factory> |
metastoreClientFactory(Identifier identifier,
TableSchema schema)
Get metastore client factory for the table specified by
identifier . |
static String |
possibleHiveConfPath() |
protected void |
renameTableImpl(Identifier fromTable,
Identifier toTable) |
void |
renameView(Identifier fromView,
Identifier toView,
boolean ignoreIfNotExists)
Rename a view.
|
void |
repairCatalog() |
void |
repairDatabase(String databaseName) |
void |
repairTable(Identifier identifier) |
boolean |
syncAllProperties() |
String |
warehouse()
Warehouse root path containing all database directories in this catalog.
|
allTablePaths, alterTable, assertMainBranch, checkNotBranch, checkNotSystemDatabase, checkNotSystemTable, createDatabase, createPartition, createTable, dropDatabase, dropTable, fileIO, getDatabase, getTable, isSpecifiedSystemTable, isSystemDatabase, isTableInSystemDatabase, listDatabasesInFileSystem, listPartitions, listTables, listTablesInFileSystem, lockEnabled, lockFactory, newDatabasePath, newDatabasePath, newTableLocation, objectFileIO, options, renameTable, tableExistsInFileSystem, tableSchemaInFileSystem, validateFieldNameCaseInsensitive, validateIdentifierNameCaseInsensitive
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
alterTable, createDatabase, 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()
lockContext
in class AbstractCatalog
public Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier, TableSchema schema)
AbstractCatalog
identifier
.metastoreClientFactory
in class AbstractCatalog
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 Database getDatabaseImpl(String name) throws Catalog.DatabaseNotExistException
getDatabaseImpl
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
protected AbstractCatalog.TableMeta getDataTableMeta(Identifier identifier) throws Catalog.TableNotExistException
getDataTableMeta
in class AbstractCatalog
Catalog.TableNotExistException
public TableSchema getDataTableSchema(Identifier identifier) throws Catalog.TableNotExistException
getDataTableSchema
in class AbstractCatalog
Catalog.TableNotExistException
public View getView(Identifier identifier) throws Catalog.ViewNotExistException
Catalog
View
identified by the given Identifier
.identifier
- Path of the viewCatalog.ViewNotExistException
- if the target does not existpublic void createView(Identifier identifier, View view, boolean ignoreIfExists) throws Catalog.ViewAlreadyExistException, Catalog.DatabaseNotExistException
Catalog
identifier
- path of the view to be createdview
- the view definitionignoreIfExists
- flag to specify behavior when a view already exists at the given path:
if set to false, it throws a ViewAlreadyExistException, if set to true, do nothing.Catalog.ViewAlreadyExistException
- if view already exists and ignoreIfExists is falseCatalog.DatabaseNotExistException
- if the database in identifier doesn't existpublic void dropView(Identifier identifier, boolean ignoreIfNotExists) throws Catalog.ViewNotExistException
Catalog
identifier
- Path of the view to be droppedignoreIfNotExists
- Flag to specify behavior when the view does not exist: if set to
false, throw an exception, if set to true, do nothing.Catalog.ViewNotExistException
- if the view does not existpublic List<String> listViews(String databaseName) throws Catalog.DatabaseNotExistException
Catalog
Catalog.DatabaseNotExistException
- if the database does not existpublic void renameView(Identifier fromView, Identifier toView, boolean ignoreIfNotExists) throws Catalog.ViewNotExistException, Catalog.ViewAlreadyExistException
Catalog
fromView
- identifier of the view to renametoView
- new view identifierCatalog.ViewNotExistException
- if the fromView does not existCatalog.ViewAlreadyExistException
- if the toView already existspublic Table getDataOrFormatTable(Identifier identifier) throws Catalog.TableNotExistException
getDataOrFormatTable
in class AbstractCatalog
Catalog.TableNotExistException
public void createFormatTable(Identifier identifier, Schema schema)
AbstractCatalog
FormatTable
identified by the given Identifier
.createFormatTable
in class AbstractCatalog
identifier
- Path of the tableschema
- Schema of the tableprotected 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
protected boolean allowCustomTablePath()
allowCustomTablePath
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
public org.apache.hadoop.hive.metastore.api.Table getHmsTable(Identifier identifier) throws Catalog.TableNotExistException
Catalog.TableNotExistException
public static boolean isView(org.apache.hadoop.hive.metastore.api.Table table)
@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 String possibleHiveConfPath()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.