public class HiveCatalog extends AbstractCatalog
Catalog.BranchAlreadyExistException, Catalog.BranchNotExistException, Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException, Catalog.DatabaseAlreadyExistException, Catalog.DatabaseNoPermissionException, Catalog.DatabaseNotEmptyException, Catalog.DatabaseNotExistException, Catalog.DialectAlreadyExistException, Catalog.DialectNotExistException, Catalog.ProcessSystemDatabaseException, Catalog.TableAlreadyExistException, Catalog.TableNoPermissionException, Catalog.TableNotExistException, Catalog.TagNotExistException, Catalog.ViewAlreadyExistException, Catalog.ViewNotExistException| Modifier and Type | Field and Description |
|---|---|
static String |
HIVE_SITE_FILE |
static String |
PAIMON_TABLE_IDENTIFIER |
static String |
TABLE_TYPE_PROP |
catalogOptions, fileIO, tableDefaultOptionsCOMMENT_PROP, DB_LOCATION_PROP, DB_SUFFIX, DEFAULT_DATABASE, 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() |
protected void |
alterDatabaseImpl(String name,
List<PropertyChange> changes) |
void |
alterPartitions(Identifier identifier,
List<PartitionStatistics> partitions)
Alter partitions of the specify table.
|
protected void |
alterTableImpl(Identifier identifier,
List<SchemaChange> changes) |
boolean |
caseSensitive()
Return a boolean that indicates whether this catalog is case-sensitive.
|
CatalogLoader |
catalogLoader()
Serializable loader to create catalog.
|
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) |
void |
createPartitions(Identifier identifier,
List<Map<String,String>> partitions)
Create partitions of the specify table.
|
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 |
dropPartitions(Identifier identifier,
List<Map<String,String>> partitions)
Drop partitions of the specify table.
|
protected void |
dropTableImpl(Identifier identifier,
List<Path> externalPaths) |
void |
dropView(Identifier identifier,
boolean ignoreIfNotExists)
Drop a view.
|
int |
getBatchGetTableSize() |
Database |
getDatabaseImpl(String name) |
org.apache.hadoop.hive.metastore.IMetaStoreClient |
getHmsClient() |
org.apache.hadoop.hive.metastore.api.Table |
getHmsTable(Identifier identifier) |
Path |
getTableLocation(Identifier identifier) |
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.
|
List<Partition> |
listPartitions(Identifier identifier)
Get Partition of all partitions of the table.
|
protected List<String> |
listTablesImpl(String databaseName) |
PagedList<View> |
listViewDetailsPaged(String databaseName,
Integer maxResults,
String pageToken)
Get paged list view details under this database.
|
List<String> |
listViews(String databaseName)
Get names of all views under this database.
|
protected TableMetadata |
loadTableMetadata(Identifier identifier) |
TableSchema |
loadTableSchema(Identifier identifier) |
Optional<CatalogLockContext> |
lockContext() |
void |
markDonePartitions(Identifier identifier,
List<Map<String,String>> partitions)
Mark partitions done of the specify table.
|
static String |
possibleHiveConfPath() |
protected void |
renameTableImpl(Identifier fromTable,
Identifier toTable) |
void |
renameView(Identifier fromView,
Identifier toView,
boolean ignoreIfNotExists)
Rename a view.
|
void |
repairCatalog()
Repair the entire Catalog, repair the metadata in the metastore consistent with the metadata
in the filesystem, register missing tables in the metastore.
|
void |
repairDatabase(String databaseName)
Repair the entire database, repair the metadata in the metastore consistent with the metadata
in the filesystem, register missing tables in the metastore.
|
void |
repairTable(Identifier identifier)
Repair the table, repair the metadata in the metastore consistent with the metadata in the
filesystem.
|
<T> T |
runWithLock(Identifier identifier,
Callable<T> callable) |
boolean |
syncAllProperties() |
String |
warehouse() |
alterDatabase, alterTable, assertMainBranch, commitSnapshot, createBranch, createDatabase, createTable, dropBranch, dropDatabase, dropTable, fastForward, fileIO, fileIO, getDatabase, getTable, listBranches, listDatabasesInFileSystem, listDatabasesPaged, listPartitionsPaged, listTableDetailsPaged, listTableDetailsPagedImpl, listTables, listTablesInFileSystem, listTablesPaged, loadSnapshot, lockEnabled, lockFactory, newDatabasePath, newDatabasePath, newTableLocation, options, renameTable, rollbackTo, supportsListObjectsPaged, supportsVersionManagement, tableExistsInFileSystem, tableSchemaInFileSystemclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitalterTable, alterView, createDatabase, invalidateTable, listViewsPagedpublic static final String TABLE_TYPE_PROP
public static final String PAIMON_TABLE_IDENTIFIER
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 AbstractCatalogpublic Optional<CatalogLockContext> lockContext()
lockContext in class AbstractCatalogpublic Path getTableLocation(Identifier identifier)
getTableLocation in class AbstractCatalogpublic List<String> listDatabases()
Catalogprotected void createDatabaseImpl(String name, Map<String,String> properties)
createDatabaseImpl in class AbstractCatalogpublic Database getDatabaseImpl(String name) throws Catalog.DatabaseNotExistException
getDatabaseImpl in class AbstractCatalogCatalog.DatabaseNotExistExceptionpublic void createPartitions(Identifier identifier, List<Map<String,String>> partitions) throws Catalog.TableNotExistException
CatalogcreatePartitions in interface CatalogcreatePartitions in class AbstractCatalogidentifier - path of the table to create partitionspartitions - partitions to be createdCatalog.TableNotExistException - if the table does not existpublic void dropPartitions(Identifier identifier, List<Map<String,String>> partitions) throws Catalog.TableNotExistException
CatalogdropPartitions in interface CatalogdropPartitions in class AbstractCatalogidentifier - path of the table to drop partitionspartitions - partitions to be deletedCatalog.TableNotExistException - if the table does not existpublic void alterPartitions(Identifier identifier, List<PartitionStatistics> partitions) throws Catalog.TableNotExistException
CatalogalterPartitions in interface CatalogalterPartitions in class AbstractCatalogidentifier - path of the table to alter partitionspartitions - partitions to be alteredCatalog.TableNotExistException - if the table does not existpublic void markDonePartitions(Identifier identifier, List<Map<String,String>> partitions) throws Catalog.TableNotExistException
CatalogmarkDonePartitions in interface CatalogmarkDonePartitions in class AbstractCatalogidentifier - path of the table to mark done partitionspartitions - partitions to be marked doneCatalog.TableNotExistException - if the table does not existpublic List<Partition> listPartitions(Identifier identifier) throws Catalog.TableNotExistException
CataloglistPartitions in interface CataloglistPartitions in class AbstractCatalogidentifier - path of the table to list partitionsCatalog.TableNotExistException - if the table does not existprotected void dropDatabaseImpl(String name)
dropDatabaseImpl in class AbstractCatalogprotected void alterDatabaseImpl(String name, List<PropertyChange> changes)
alterDatabaseImpl in class AbstractCatalogprotected List<String> listTablesImpl(String databaseName)
listTablesImpl in class AbstractCatalogprotected TableMetadata loadTableMetadata(Identifier identifier) throws Catalog.TableNotExistException
loadTableMetadata in class AbstractCatalogCatalog.TableNotExistExceptionpublic TableSchema loadTableSchema(Identifier identifier) throws Catalog.TableNotExistException
loadTableSchema in class AbstractCatalogCatalog.TableNotExistExceptionpublic View getView(Identifier identifier) throws Catalog.ViewNotExistException
CatalogView 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
Catalogidentifier - 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
Catalogidentifier - 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
CatalogCatalog.DatabaseNotExistException - if the database does not existpublic PagedList<View> listViewDetailsPaged(String databaseName, Integer maxResults, String pageToken) throws Catalog.DatabaseNotExistException
CatalogdatabaseName - Name of the database to list views.maxResults - Optional parameter indicating the maximum number of results to include in
the result. If maxResults is not specified or set to 0, will return the default number of
max results.pageToken - Optional parameter indicating the next page token allows list to be start
from a specific point.Catalog.supportsListObjectsPaged().Catalog.DatabaseNotExistException - if the database does not existpublic void renameView(Identifier fromView, Identifier toView, boolean ignoreIfNotExists) throws Catalog.ViewNotExistException, Catalog.ViewAlreadyExistException
CatalogfromView - identifier of the view to renametoView - new view identifierCatalog.ViewNotExistException - if the fromView does not existCatalog.ViewAlreadyExistException - if the toView already existspublic void createFormatTable(Identifier identifier, Schema schema)
AbstractCatalogFormatTable identified by the given Identifier.createFormatTable in class AbstractCatalogidentifier - Path of the tableschema - Schema of the tableprotected void dropTableImpl(Identifier identifier, List<Path> externalPaths)
dropTableImpl in class AbstractCatalogprotected void createTableImpl(Identifier identifier, Schema schema)
createTableImpl in class AbstractCatalogprotected void renameTableImpl(Identifier fromTable, Identifier toTable)
renameTableImpl in class AbstractCatalogprotected void alterTableImpl(Identifier identifier, List<SchemaChange> changes) throws Catalog.TableNotExistException, Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException
alterTableImpl in class AbstractCatalogCatalog.TableNotExistExceptionCatalog.ColumnAlreadyExistExceptionCatalog.ColumnNotExistExceptionpublic boolean caseSensitive()
Catalogprotected boolean allowCustomTablePath()
allowCustomTablePath in class AbstractCatalogpublic boolean syncAllProperties()
public void repairCatalog()
Catalogpublic void repairDatabase(String databaseName)
Catalogpublic void repairTable(Identifier identifier) throws Catalog.TableNotExistException
CatalogCatalog.TableNotExistExceptionpublic String warehouse()
warehouse in class AbstractCatalogpublic CatalogLoader catalogLoader()
Catalogpublic org.apache.hadoop.hive.metastore.api.Table getHmsTable(Identifier identifier) throws Catalog.TableNotExistException
Catalog.TableNotExistExceptionpublic static boolean isView(org.apache.hadoop.hive.metastore.api.Table table)
@VisibleForTesting public org.apache.hadoop.hive.metastore.IMetaStoreClient getHmsClient()
public <T> T runWithLock(Identifier identifier, Callable<T> callable) throws Exception
Exceptionpublic 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()
public int getBatchGetTableSize()
Copyright © 2023–2025 The Apache Software Foundation. All rights reserved.