http://git-wip-us.apache.org/repos/asf/hive/blob/35f86c74/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java deleted file mode 100644 index 54e7eda..0000000 --- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ /dev/null @@ -1,3761 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.metastore; - - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hive.common.ValidTxnList; -import org.apache.hadoop.hive.common.ValidWriteIdList; -import org.apache.hadoop.hive.common.classification.RetrySemantics; -import org.apache.hadoop.hive.metastore.annotation.NoReconnect; -import org.apache.hadoop.hive.metastore.api.AggrStats; -import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; -import org.apache.hadoop.hive.metastore.api.CheckConstraintsRequest; -import org.apache.hadoop.hive.metastore.api.Catalog; -import org.apache.hadoop.hive.metastore.api.CmRecycleRequest; -import org.apache.hadoop.hive.metastore.api.CmRecycleResponse; -import org.apache.hadoop.hive.metastore.api.ColumnStatistics; -import org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj; -import org.apache.hadoop.hive.metastore.api.CommitTxnRequest; -import org.apache.hadoop.hive.metastore.api.CompactionResponse; -import org.apache.hadoop.hive.metastore.api.CompactionType; -import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException; -import org.apache.hadoop.hive.metastore.api.CreationMetadata; -import org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId; -import org.apache.hadoop.hive.metastore.api.DataOperationType; -import org.apache.hadoop.hive.metastore.api.DefaultConstraintsRequest; -import org.apache.hadoop.hive.metastore.api.Database; -import org.apache.hadoop.hive.metastore.api.EnvironmentContext; -import org.apache.hadoop.hive.metastore.api.FieldSchema; -import org.apache.hadoop.hive.metastore.api.FindSchemasByColsResp; -import org.apache.hadoop.hive.metastore.api.FindSchemasByColsRqst; -import org.apache.hadoop.hive.metastore.api.FireEventRequest; -import org.apache.hadoop.hive.metastore.api.FireEventResponse; -import org.apache.hadoop.hive.metastore.api.ForeignKeysRequest; -import org.apache.hadoop.hive.metastore.api.Function; -import org.apache.hadoop.hive.metastore.api.GetAllFunctionsResponse; -import org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse; -import org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleRequest; -import org.apache.hadoop.hive.metastore.api.GetPrincipalsInRoleResponse; -import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalRequest; -import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalResponse; -import org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeResponse; -import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege; -import org.apache.hadoop.hive.metastore.api.HiveObjectRef; -import org.apache.hadoop.hive.metastore.api.ISchema; -import org.apache.hadoop.hive.metastore.api.InvalidInputException; -import org.apache.hadoop.hive.metastore.api.InvalidObjectException; -import org.apache.hadoop.hive.metastore.api.InvalidOperationException; -import org.apache.hadoop.hive.metastore.api.InvalidPartitionException; -import org.apache.hadoop.hive.metastore.api.LockRequest; -import org.apache.hadoop.hive.metastore.api.LockResponse; -import org.apache.hadoop.hive.metastore.api.Materialization; -import org.apache.hadoop.hive.metastore.api.MetaException; -import org.apache.hadoop.hive.metastore.api.MetadataPpdResult; -import org.apache.hadoop.hive.metastore.api.NoSuchLockException; -import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; -import org.apache.hadoop.hive.metastore.api.NoSuchTxnException; -import org.apache.hadoop.hive.metastore.api.NotNullConstraintsRequest; -import org.apache.hadoop.hive.metastore.api.NotificationEvent; -import org.apache.hadoop.hive.metastore.api.NotificationEventResponse; -import org.apache.hadoop.hive.metastore.api.NotificationEventsCountRequest; -import org.apache.hadoop.hive.metastore.api.NotificationEventsCountResponse; -import org.apache.hadoop.hive.metastore.api.OpenTxnsResponse; -import org.apache.hadoop.hive.metastore.api.Partition; -import org.apache.hadoop.hive.metastore.api.PartitionEventType; -import org.apache.hadoop.hive.metastore.api.PartitionValuesRequest; -import org.apache.hadoop.hive.metastore.api.PartitionValuesResponse; -import org.apache.hadoop.hive.metastore.api.PrimaryKeysRequest; -import org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet; -import org.apache.hadoop.hive.metastore.api.PrincipalType; -import org.apache.hadoop.hive.metastore.api.PrivilegeBag; -import org.apache.hadoop.hive.metastore.api.Role; -import org.apache.hadoop.hive.metastore.api.RuntimeStat; -import org.apache.hadoop.hive.metastore.api.SQLCheckConstraint; -import org.apache.hadoop.hive.metastore.api.SQLDefaultConstraint; -import org.apache.hadoop.hive.metastore.api.SQLForeignKey; -import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint; -import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey; -import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint; -import org.apache.hadoop.hive.metastore.api.SchemaVersion; -import org.apache.hadoop.hive.metastore.api.SchemaVersionState; -import org.apache.hadoop.hive.metastore.api.SerDeInfo; -import org.apache.hadoop.hive.metastore.api.SetPartitionsStatsRequest; -import org.apache.hadoop.hive.metastore.api.ShowCompactResponse; -import org.apache.hadoop.hive.metastore.api.ShowLocksRequest; -import org.apache.hadoop.hive.metastore.api.ShowLocksResponse; -import org.apache.hadoop.hive.metastore.api.Table; -import org.apache.hadoop.hive.metastore.api.TableMeta; -import org.apache.hadoop.hive.metastore.api.TableValidWriteIds; -import org.apache.hadoop.hive.metastore.api.TxnAbortedException; -import org.apache.hadoop.hive.metastore.api.TxnOpenException; -import org.apache.hadoop.hive.metastore.api.TxnToWriteId; -import org.apache.hadoop.hive.metastore.api.UniqueConstraintsRequest; -import org.apache.hadoop.hive.metastore.api.UnknownDBException; -import org.apache.hadoop.hive.metastore.api.UnknownPartitionException; -import org.apache.hadoop.hive.metastore.api.UnknownTableException; -import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan; -import org.apache.hadoop.hive.metastore.api.WMMapping; -import org.apache.hadoop.hive.metastore.api.WMNullablePool; -import org.apache.hadoop.hive.metastore.api.WMNullableResourcePlan; -import org.apache.hadoop.hive.metastore.api.WMPool; -import org.apache.hadoop.hive.metastore.api.WMResourcePlan; -import org.apache.hadoop.hive.metastore.api.WMTrigger; -import org.apache.hadoop.hive.metastore.api.WMValidateResourcePlanResponse; -import org.apache.hadoop.hive.metastore.api.WriteNotificationLogRequest; -import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy; -import org.apache.hadoop.hive.metastore.utils.ObjectPair; -import org.apache.thrift.TException; - -/** - * Wrapper around hive metastore thrift api - */ [email protected] [email protected] -public interface IMetaStoreClient { - - /** - * Returns whether current client is compatible with conf argument or not - * @return - */ - boolean isCompatibleWith(Configuration conf); - - /** - * Set added jars path info to MetaStoreClient. - * @param addedJars the hive.added.jars.path. It is qualified paths separated by commas. - */ - void setHiveAddedJars(String addedJars); - - /** - * Returns true if the current client is using an in process metastore (local metastore). - * - * @return - */ - boolean isLocalMetaStore(); - - /** - * Tries to reconnect this MetaStoreClient to the MetaStore. - */ - void reconnect() throws MetaException; - - /** - * close connection to meta store - */ - @NoReconnect - void close(); - - /** - * set meta variable which is open to end users - */ - void setMetaConf(String key, String value) throws MetaException, TException; - - /** - * get current meta variable - */ - String getMetaConf(String key) throws MetaException, TException; - - /** - * Create a new catalog. - * @param catalog catalog object to create. - * @throws AlreadyExistsException A catalog of this name already exists. - * @throws InvalidObjectException There is something wrong with the passed in catalog object. - * @throws MetaException something went wrong, usually either in the database or trying to - * create the directory for the catalog. - * @throws TException general thrift exception. - */ - void createCatalog(Catalog catalog) - throws AlreadyExistsException, InvalidObjectException, MetaException, TException; - - /** - * Alter an existing catalog. - * @param catalogName the name of the catalog to alter. - * @param newCatalog the new catalog object. All relevant details of the catalog should be - * set, don't rely on the system to figure out what you changed and only copy - * that in. - * @throws NoSuchObjectException no catalog of this name exists - * @throws InvalidObjectException an attempt was made to make an unsupported change (such as - * catalog name). - * @throws MetaException usually indicates a database error - * @throws TException general thrift exception - */ - void alterCatalog(String catalogName, Catalog newCatalog) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; - - /** - * Get a catalog object. - * @param catName Name of the catalog to fetch. - * @return The catalog. - * @throws NoSuchObjectException no catalog of this name exists. - * @throws MetaException something went wrong, usually in the database. - * @throws TException general thrift exception. - */ - Catalog getCatalog(String catName) throws NoSuchObjectException, MetaException, TException; - - /** - * Get a list of all catalogs known to the system. - * @return list of catalog names - * @throws MetaException something went wrong, usually in the database. - * @throws TException general thrift exception. - */ - List<String> getCatalogs() throws MetaException, TException; - - /** - * Drop a catalog. Catalogs must be empty to be dropped, there is no cascade for dropping a - * catalog. - * @param catName name of the catalog to drop - * @throws NoSuchObjectException no catalog of this name exists. - * @throws InvalidOperationException The catalog is not empty and cannot be dropped. - * @throws MetaException something went wrong, usually in the database. - * @throws TException general thrift exception. - */ - void dropCatalog(String catName) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; - - /** - * Get the names of all databases in the default catalog that match the given pattern. - * @param databasePattern pattern for the database name to patch - * @return List of database names. - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<String> getDatabases(String databasePattern) throws MetaException, TException; - - /** - * Get all databases in a catalog whose names match a pattern. - * @param catName catalog name. Can be null, in which case the default catalog is assumed. - * @param databasePattern pattern for the database name to match - * @return list of database names - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<String> getDatabases(String catName, String databasePattern) - throws MetaException, TException; - - /** - * Get the names of all databases in the MetaStore. - * @return List of database names in the default catalog. - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<String> getAllDatabases() throws MetaException, TException; - - /** - * Get all databases in a catalog. - * @param catName catalog name. Can be null, in which case the default catalog is assumed. - * @return list of all database names - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<String> getAllDatabases(String catName) throws MetaException, TException; - - /** - * Get the names of all tables in the specified database that satisfy the supplied - * table name pattern. - * @param dbName database name. - * @param tablePattern pattern for table name to conform to - * @return List of table names. - * @throws MetaException error fetching information from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException indicated database to search in does not exist. - */ - List<String> getTables(String dbName, String tablePattern) - throws MetaException, TException, UnknownDBException; - - /** - * Get the names of all tables in the specified database that satisfy the supplied - * table name pattern. - * @param catName catalog name. - * @param dbName database name. - * @param tablePattern pattern for table name to conform to - * @return List of table names. - * @throws MetaException error fetching information from the RDBMS - * @throws TException general thrift error - * @throws UnknownDBException indicated database to search in does not exist. - */ - List<String> getTables(String catName, String dbName, String tablePattern) - throws MetaException, TException, UnknownDBException; - - - /** - * Get the names of all tables in the specified database that satisfy the supplied - * table name pattern and table type (MANAGED_TABLE || EXTERNAL_TABLE || VIRTUAL_VIEW) - * @param dbName Name of the database to fetch tables in. - * @param tablePattern pattern to match for table names. - * @param tableType Type of the table in the HMS store. VIRTUAL_VIEW is for views. - * @return List of table names. - * @throws MetaException error fetching information from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException indicated database does not exist. - */ - List<String> getTables(String dbName, String tablePattern, TableType tableType) - throws MetaException, TException, UnknownDBException; - - /** - * Get the names of all tables in the specified database that satisfy the supplied - * table name pattern and table type (MANAGED_TABLE || EXTERNAL_TABLE || VIRTUAL_VIEW) - * @param catName catalog name. - * @param dbName Name of the database to fetch tables in. - * @param tablePattern pattern to match for table names. - * @param tableType Type of the table in the HMS store. VIRTUAL_VIEW is for views. - * @return List of table names. - * @throws MetaException error fetching information from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException indicated database does not exist. - */ - List<String> getTables(String catName, String dbName, String tablePattern, TableType tableType) - throws MetaException, TException, UnknownDBException; - - /** - * Get materialized views that have rewriting enabled. This will use the default catalog. - * @param dbName Name of the database to fetch materialized views from. - * @return List of materialized view names. - * @throws MetaException error fetching from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException no such database - */ - List<String> getMaterializedViewsForRewriting(String dbName) - throws MetaException, TException, UnknownDBException; - - /** - * Get materialized views that have rewriting enabled. - * @param catName catalog name. - * @param dbName Name of the database to fetch materialized views from. - * @return List of materialized view names. - * @throws MetaException error fetching from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException no such database - */ - List<String> getMaterializedViewsForRewriting(String catName, String dbName) - throws MetaException, TException, UnknownDBException; - - /** - * Fetches just table name and comments. Useful when you need full table name - * (catalog.database.table) but don't need extra information like partition columns that - * require additional fetches from the database. - * @param dbPatterns database pattern to match, or null for all databases - * @param tablePatterns table pattern to match. - * @param tableTypes list of table types to fetch. - * @return list of TableMeta objects with information on matching tables - * @throws MetaException something went wrong with the fetch from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException No databases match the provided pattern. - */ - List<TableMeta> getTableMeta(String dbPatterns, String tablePatterns, List<String> tableTypes) - throws MetaException, TException, UnknownDBException; - - /** - * Fetches just table name and comments. Useful when you need full table name - * (catalog.database.table) but don't need extra information like partition columns that - * require additional fetches from the database. - * @param catName catalog to search in. Search cannot cross catalogs. - * @param dbPatterns database pattern to match, or null for all databases - * @param tablePatterns table pattern to match. - * @param tableTypes list of table types to fetch. - * @return list of TableMeta objects with information on matching tables - * @throws MetaException something went wrong with the fetch from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException No databases match the provided pattern. - */ - List<TableMeta> getTableMeta(String catName, String dbPatterns, String tablePatterns, - List<String> tableTypes) - throws MetaException, TException, UnknownDBException; - - /** - * Get the names of all tables in the specified database. - * @param dbName database name - * @return List of table names. - * @throws MetaException something went wrong with the fetch from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException No databases match the provided pattern. - */ - List<String> getAllTables(String dbName) throws MetaException, TException, UnknownDBException; - - /** - * Get the names of all tables in the specified database. - * @param catName catalog name - * @param dbName database name - * @return List of table names. - * @throws MetaException something went wrong with the fetch from the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException No databases match the provided pattern. - */ - List<String> getAllTables(String catName, String dbName) - throws MetaException, TException, UnknownDBException; - - /** - * Get a list of table names that match a filter. - * The filter operators are LIKE, <, <=, >, >=, =, <> - * - * In the filter statement, values interpreted as strings must be enclosed in quotes, - * while values interpreted as integers should not be. Strings and integers are the only - * supported value types. - * - * The currently supported key names in the filter are: - * Constants.HIVE_FILTER_FIELD_OWNER, which filters on the tables' owner's name - * and supports all filter operators - * Constants.HIVE_FILTER_FIELD_LAST_ACCESS, which filters on the last access times - * and supports all filter operators except LIKE - * Constants.HIVE_FILTER_FIELD_PARAMS, which filters on the tables' parameter keys and values - * and only supports the filter operators = and <>. - * Append the parameter key name to HIVE_FILTER_FIELD_PARAMS in the filter statement. - * For example, to filter on parameter keys called "retention", the key name in the filter - * statement should be Constants.HIVE_FILTER_FIELD_PARAMS + "retention" - * Also, = and <> only work for keys that exist in the tables. - * E.g., filtering on tables where key1 <> value will only - * return tables that have a value for the parameter key1. - * Some example filter statements include: - * filter = Constants.HIVE_FILTER_FIELD_OWNER + " like \".*test.*\" and " + - * Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0"; - * filter = Constants.HIVE_FILTER_FIELD_OWNER + " = \"test_user\" and (" + - * Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " + - * Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\")" - * - * @param dbName - * The name of the database from which you will retrieve the table names - * @param filter - * The filter string - * @param maxTables - * The maximum number of tables returned - * @return A list of table names that match the desired filter - * @throws InvalidOperationException invalid filter - * @throws UnknownDBException no such database - * @throws TException thrift transport error - */ - List<String> listTableNamesByFilter(String dbName, String filter, short maxTables) - throws TException, InvalidOperationException, UnknownDBException; - - /** - * Get a list of table names that match a filter. - * The filter operators are LIKE, <, <=, >, >=, =, <> - * - * In the filter statement, values interpreted as strings must be enclosed in quotes, - * while values interpreted as integers should not be. Strings and integers are the only - * supported value types. - * - * The currently supported key names in the filter are: - * Constants.HIVE_FILTER_FIELD_OWNER, which filters on the tables' owner's name - * and supports all filter operators - * Constants.HIVE_FILTER_FIELD_LAST_ACCESS, which filters on the last access times - * and supports all filter operators except LIKE - * Constants.HIVE_FILTER_FIELD_PARAMS, which filters on the tables' parameter keys and values - * and only supports the filter operators = and <>. - * Append the parameter key name to HIVE_FILTER_FIELD_PARAMS in the filter statement. - * For example, to filter on parameter keys called "retention", the key name in the filter - * statement should be Constants.HIVE_FILTER_FIELD_PARAMS + "retention" - * Also, = and <> only work for keys that exist in the tables. - * E.g., filtering on tables where key1 <> value will only - * return tables that have a value for the parameter key1. - * Some example filter statements include: - * filter = Constants.HIVE_FILTER_FIELD_OWNER + " like \".*test.*\" and " + - * Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0"; - * filter = Constants.HIVE_FILTER_FIELD_OWNER + " = \"test_user\" and (" + - * Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " + - * Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\")" - * - * @param catName catalog name - * @param dbName - * The name of the database from which you will retrieve the table names - * @param filter - * The filter string - * @param maxTables - * The maximum number of tables returned - * @return A list of table names that match the desired filter - * @throws InvalidOperationException invalid filter - * @throws UnknownDBException no such database - * @throws TException thrift transport error - */ - List<String> listTableNamesByFilter(String catName, String dbName, String filter, int maxTables) - throws TException, InvalidOperationException, UnknownDBException; - - /** - * Drop the table. - * - * @param dbname - * The database for this table - * @param tableName - * The table to drop - * @param deleteData - * Should we delete the underlying data - * @param ignoreUnknownTab - * don't throw if the requested table doesn't exist - * @throws MetaException - * Could not drop table properly. - * @throws NoSuchObjectException - * The table wasn't found. - * @throws TException - * A thrift communication error occurred - * - */ - void dropTable(String dbname, String tableName, boolean deleteData, - boolean ignoreUnknownTab) throws MetaException, TException, - NoSuchObjectException; - - /** - * Drop the table. - * - * @param dbname - * The database for this table - * @param tableName - * The table to drop - * @param deleteData - * Should we delete the underlying data - * @param ignoreUnknownTab - * don't throw if the requested table doesn't exist - * @param ifPurge - * completely purge the table (skipping trash) while removing data from warehouse - * @throws MetaException - * Could not drop table properly. - * @throws NoSuchObjectException - * The table wasn't found. - * @throws TException - * A thrift communication error occurred - */ - @Deprecated // TODO: deprecate all methods without a catalog here; a single layer (e.g. Hive.java) should handle current-catalog - void dropTable(String dbname, String tableName, boolean deleteData, - boolean ignoreUnknownTab, boolean ifPurge) throws MetaException, TException, - NoSuchObjectException; - - /** - * Drop the table. - * - * @param dbname - * The database for this table - * @param tableName - * The table to drop - * @throws MetaException - * Could not drop table properly. - * @throws NoSuchObjectException - * The table wasn't found. - * @throws TException - * A thrift communication error occurred - */ - void dropTable(String dbname, String tableName) - throws MetaException, TException, NoSuchObjectException; - - /** - * Drop a table. - * @param catName catalog the table is in. - * @param dbName database the table is in. - * @param tableName table name. - * @param deleteData whether associated data should be deleted. - * @param ignoreUnknownTable whether a non-existent table name should be ignored - * @param ifPurge whether dropped data should be immediately removed rather than placed in HDFS - * trash. - * @throws MetaException something went wrong, usually in the RDBMS or storage. - * @throws NoSuchObjectException No table of this name exists, only thrown if - * ignoreUnknownTable is false. - * @throws TException general thrift error. - */ - void dropTable(String catName, String dbName, String tableName, boolean deleteData, - boolean ignoreUnknownTable, boolean ifPurge) - throws MetaException, NoSuchObjectException, TException; - - /** - * Drop a table. Equivalent to - * {@link #dropTable(String, String, String, boolean, boolean, boolean)} with ifPurge set to - * false. - * @param catName catalog the table is in. - * @param dbName database the table is in. - * @param tableName table name. - * @param deleteData whether associated data should be deleted. - * @param ignoreUnknownTable whether a non-existent table name should be ignored - * @throws MetaException something went wrong, usually in the RDBMS or storage. - * @throws NoSuchObjectException No table of this name exists, only thrown if - * ignoreUnknownTable is false. - * @throws TException general thrift error. - */ - default void dropTable(String catName, String dbName, String tableName, boolean deleteData, - boolean ignoreUnknownTable) - throws MetaException, NoSuchObjectException, TException { - dropTable(catName, dbName, tableName, deleteData, ignoreUnknownTable, false); - } - - /** - * Drop a table. Equivalent to - * {@link #dropTable(String, String, String, boolean, boolean, boolean)} with deleteData - * set and ignoreUnknownTable set to true and ifPurge set to false. - * @param catName catalog the table is in. - * @param dbName database the table is in. - * @param tableName table name. - * @throws MetaException something went wrong, usually in the RDBMS or storage. - * @throws NoSuchObjectException No table of this name exists, only thrown if - * ignoreUnknownTable is false. - * @throws TException general thrift error. - */ - default void dropTable(String catName, String dbName, String tableName) - throws MetaException, NoSuchObjectException, TException { - dropTable(catName, dbName, tableName, true, true, false); - } - - /** - * Truncate the table/partitions in the DEFAULT database. - * @param dbName - * The db to which the table to be truncate belongs to - * @param tableName - * The table to truncate - * @param partNames - * List of partitions to truncate. NULL will truncate the whole table/all partitions - * @throws MetaException Failure in the RDBMS or storage - * @throws TException Thrift transport exception - */ - void truncateTable(String dbName, String tableName, List<String> partNames) throws MetaException, TException; - - void truncateTable(String dbName, String tableName, List<String> partNames, - String validWriteIds, long writeId) throws TException; - - /** - * Truncate the table/partitions in the DEFAULT database. - * @param catName catalog name - * @param dbName - * The db to which the table to be truncate belongs to - * @param tableName - * The table to truncate - * @param partNames - * List of partitions to truncate. NULL will truncate the whole table/all partitions - * @throws MetaException Failure in the RDBMS or storage - * @throws TException Thrift transport exception - */ - void truncateTable(String catName, String dbName, String tableName, List<String> partNames) - throws MetaException, TException; - - /** - * Recycles the files recursively from the input path to the cmroot directory either by copying or moving it. - * - * @param request Inputs for path of the data files to be recycled to cmroot and - * isPurge flag when set to true files which needs to be recycled are not moved to Trash - * @return Response which is currently void - */ - CmRecycleResponse recycleDirToCmPath(CmRecycleRequest request) throws MetaException, TException; - - /** - * Check whether a table exists in the default catalog. - * @param databaseName database name - * @param tableName table name - * @return true if the indicated table exists, false if not - * @throws MetaException error fetching form the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException the indicated database does not exist. - */ - boolean tableExists(String databaseName, String tableName) - throws MetaException, TException, UnknownDBException; - - /** - * Check whether a table exists. - * @param catName catalog name - * @param dbName database name - * @param tableName table name - * @return true if the indicated table exists, false if not - * @throws MetaException error fetching form the RDBMS - * @throws TException thrift transport error - * @throws UnknownDBException the indicated database does not exist. - */ - boolean tableExists(String catName, String dbName, String tableName) - throws MetaException, TException, UnknownDBException; - - /** - * Get a Database Object in the default catalog - * @param databaseName name of the database to fetch - * @return the database - * @throws NoSuchObjectException The database does not exist - * @throws MetaException Could not fetch the database - * @throws TException A thrift communication error occurred - */ - Database getDatabase(String databaseName) - throws NoSuchObjectException, MetaException, TException; - - /** - * Get a database. - * @param catalogName catalog name. Can be null, in which case - * {@link Warehouse#DEFAULT_CATALOG_NAME} will be assumed. - * @param databaseName database name - * @return the database object - * @throws NoSuchObjectException No database with this name exists in the specified catalog - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift error - */ - Database getDatabase(String catalogName, String databaseName) - throws NoSuchObjectException, MetaException, TException; - - /** - * Get a table object in the default catalog. - * - * @param dbName - * The database the table is located in. - * @param tableName - * Name of the table to fetch. - * @return An object representing the table. - * @throws MetaException - * Could not fetch the table - * @throws TException - * A thrift communication error occurred - * @throws NoSuchObjectException - * In case the table wasn't found. - */ - Table getTable(String dbName, String tableName) throws MetaException, - TException, NoSuchObjectException; - - /** - * Get a table object. - * @param catName catalog the table is in. - * @param dbName database the table is in. - * @param tableName table name. - * @return table object. - * @throws MetaException Something went wrong, usually in the RDBMS. - * @throws TException general thrift error. - */ - Table getTable(String catName, String dbName, String tableName) throws MetaException, TException; - - Table getTable(String catName, String dbName, String tableName, - String validWriteIdList) throws TException; - /** - * Get tables as objects (rather than just fetching their names). This is more expensive and - * should only be used if you actually need all the information about the tables. - * @param dbName - * The database the tables are located in. - * @param tableNames - * The names of the tables to fetch - * @return A list of objects representing the tables. - * Only the tables that can be retrieved from the database are returned. For example, - * if none of the requested tables could be retrieved, an empty list is returned. - * There is no guarantee of ordering of the returned tables. - * @throws InvalidOperationException - * The input to this operation is invalid (e.g., the list of tables names is null) - * @throws UnknownDBException - * The requested database could not be fetched. - * @throws TException - * A thrift communication error occurred - * @throws MetaException - * Any other errors - */ - List<Table> getTableObjectsByName(String dbName, List<String> tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException; - - /** - * Get tables as objects (rather than just fetching their names). This is more expensive and - * should only be used if you actually need all the information about the tables. - * @param catName catalog name - * @param dbName - * The database the tables are located in. - * @param tableNames - * The names of the tables to fetch - * @return A list of objects representing the tables. - * Only the tables that can be retrieved from the database are returned. For example, - * if none of the requested tables could be retrieved, an empty list is returned. - * There is no guarantee of ordering of the returned tables. - * @throws InvalidOperationException - * The input to this operation is invalid (e.g., the list of tables names is null) - * @throws UnknownDBException - * The requested database could not be fetched. - * @throws TException - * A thrift communication error occurred - * @throws MetaException - * Any other errors - */ - List<Table> getTableObjectsByName(String catName, String dbName, List<String> tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException; - - /** - * Returns the invalidation information for the materialized views given as input. - */ - Materialization getMaterializationInvalidationInfo(CreationMetadata cm, String validTxnList) - throws MetaException, InvalidOperationException, UnknownDBException, TException; - - /** - * Updates the creation metadata for the materialized view. - */ - void updateCreationMetadata(String dbName, String tableName, CreationMetadata cm) - throws MetaException, TException; - - /** - * Updates the creation metadata for the materialized view. - */ - void updateCreationMetadata(String catName, String dbName, String tableName, CreationMetadata cm) - throws MetaException, TException; - - /** - /** - * Add a partition to a table and get back the resulting Partition object. This creates an - * empty default partition with just the partition values set. - * @param dbName database name - * @param tableName table name - * @param partVals partition values - * @return the partition object - * @throws InvalidObjectException no such table - * @throws AlreadyExistsException a partition with these values already exists - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - Partition appendPartition(String dbName, String tableName, List<String> partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add a partition to a table and get back the resulting Partition object. This creates an - * empty default partition with just the partition values set. - * @param catName catalog name - * @param dbName database name - * @param tableName table name - * @param partVals partition values - * @return the partition object - * @throws InvalidObjectException no such table - * @throws AlreadyExistsException a partition with these values already exists - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - Partition appendPartition(String catName, String dbName, String tableName, List<String> partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add a partition to a table and get back the resulting Partition object. This creates an - * empty default partition with just the partition value set. - * @param dbName database name. - * @param tableName table name. - * @param name name of the partition, should be in the form partkey=partval. - * @return new partition object. - * @throws InvalidObjectException No such table. - * @throws AlreadyExistsException Partition of this name already exists. - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - Partition appendPartition(String dbName, String tableName, String name) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add a partition to a table and get back the resulting Partition object. This creates an - * empty default partition with just the partition value set. - * @param catName catalog name. - * @param dbName database name. - * @param tableName table name. - * @param name name of the partition, should be in the form partkey=partval. - * @return new partition object. - * @throws InvalidObjectException No such table. - * @throws AlreadyExistsException Partition of this name already exists. - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - Partition appendPartition(String catName, String dbName, String tableName, String name) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add a partition to the table. - * - * @param partition - * The partition to add - * @return The partition added - * @throws InvalidObjectException - * Could not find table to add to - * @throws AlreadyExistsException - * Partition already exists - * @throws MetaException - * Could not add partition - * @throws TException - * Thrift exception - */ - Partition add_partition(Partition partition) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add partitions to the table. - * - * @param partitions - * The partitions to add - * @throws InvalidObjectException - * Could not find table to add to - * @throws AlreadyExistsException - * Partition already exists - * @throws MetaException - * Could not add partition - * @throws TException - * Thrift exception - */ - int add_partitions(List<Partition> partitions) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add a partitions using a spec proxy. - * @param partitionSpec partition spec proxy - * @return number of partitions that were added - * @throws InvalidObjectException the partitionSpec is malformed. - * @throws AlreadyExistsException one or more of the partitions already exist. - * @throws MetaException error accessing the RDBMS or storage. - * @throws TException thrift transport error - */ - int add_partitions_pspec(PartitionSpecProxy partitionSpec) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Add partitions to the table. - * - * @param partitions The partitions to add - * @param ifNotExists only add partitions if they don't exist - * @param needResults Whether the results are needed - * @return the partitions that were added, or null if !needResults - */ - List<Partition> add_partitions( - List<Partition> partitions, boolean ifNotExists, boolean needResults) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Get a partition. - * @param dbName database name - * @param tblName table name - * @param partVals partition values for this partition, must be in the same order as the - * partition keys of the table. - * @return the partition object - * @throws NoSuchObjectException no such partition - * @throws MetaException error access the RDBMS. - * @throws TException thrift transport error - */ - Partition getPartition(String dbName, String tblName, List<String> partVals) - throws NoSuchObjectException, MetaException, TException; - - /** - * Get a partition. - * @param catName catalog name - * @param dbName database name - * @param tblName table name - * @param partVals partition values for this partition, must be in the same order as the - * partition keys of the table. - * @return the partition object - * @throws NoSuchObjectException no such partition - * @throws MetaException error access the RDBMS. - * @throws TException thrift transport error - */ - Partition getPartition(String catName, String dbName, String tblName, List<String> partVals) - throws NoSuchObjectException, MetaException, TException; - - /** - * Move a partition from one table to another - * @param partitionSpecs key value pairs that describe the partition to be moved. - * @param sourceDb database of the source table - * @param sourceTable name of the source table - * @param destdb database of the destination table - * @param destTableName name of the destination table - * @return partition object - * @throws MetaException error accessing the RDBMS or storage - * @throws NoSuchObjectException no such table, for either source or destination table - * @throws InvalidObjectException error in partition specifications - * @throws TException thrift transport error - */ - Partition exchange_partition(Map<String, String> partitionSpecs, - String sourceDb, String sourceTable, String destdb, - String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; - - /** - * Move a partition from one table to another - * @param partitionSpecs key value pairs that describe the partition to be moved. - * @param sourceCat catalog of the source table - * @param sourceDb database of the source table - * @param sourceTable name of the source table - * @param destCat catalog of the destination table, for now must the same as sourceCat - * @param destdb database of the destination table - * @param destTableName name of the destination table - * @return partition object - * @throws MetaException error accessing the RDBMS or storage - * @throws NoSuchObjectException no such table, for either source or destination table - * @throws InvalidObjectException error in partition specifications - * @throws TException thrift transport error - */ - Partition exchange_partition(Map<String, String> partitionSpecs, String sourceCat, - String sourceDb, String sourceTable, String destCat, String destdb, - String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; - - /** - * With the one partitionSpecs to exchange, multiple partitions could be exchanged. - * e.g., year=2015/month/day, exchanging partition year=2015 results to all the partitions - * belonging to it exchanged. This function returns the list of affected partitions. - * @param partitionSpecs key value pairs that describe the partition(s) to be moved. - * @param sourceDb database of the source table - * @param sourceTable name of the source table - * @param destdb database of the destination table - * @param destTableName name of the destination table - * @throws MetaException error accessing the RDBMS or storage - * @throws NoSuchObjectException no such table, for either source or destination table - * @throws InvalidObjectException error in partition specifications - * @throws TException thrift transport error - * @return the list of the new partitions - */ - List<Partition> exchange_partitions(Map<String, String> partitionSpecs, - String sourceDb, String sourceTable, String destdb, - String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; - - /** - * With the one partitionSpecs to exchange, multiple partitions could be exchanged. - * e.g., year=2015/month/day, exchanging partition year=2015 results to all the partitions - * belonging to it exchanged. This function returns the list of affected partitions. - * @param partitionSpecs key value pairs that describe the partition(s) to be moved. - * @param sourceCat catalog of the source table - * @param sourceDb database of the source table - * @param sourceTable name of the source table - * @param destCat catalog of the destination table, for now must the same as sourceCat - * @param destdb database of the destination table - * @param destTableName name of the destination table - * @throws MetaException error accessing the RDBMS or storage - * @throws NoSuchObjectException no such table, for either source or destination table - * @throws InvalidObjectException error in partition specifications - * @throws TException thrift transport error - * @return the list of the new partitions - */ - List<Partition> exchange_partitions(Map<String, String> partitionSpecs, String sourceCat, - String sourceDb, String sourceTable, String destCat, - String destdb, String destTableName) - throws MetaException, NoSuchObjectException, InvalidObjectException, TException; - - /** - * Get a Partition by name. - * @param dbName database name. - * @param tblName table name. - * @param name - partition name i.e. 'ds=2010-02-03/ts=2010-02-03 18%3A16%3A01' - * @return the partition object - * @throws MetaException error access the RDBMS. - * @throws TException thrift transport error - */ - Partition getPartition(String dbName, String tblName, String name) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; - - /** - * Get a Partition by name. - * @param catName catalog name. - * @param dbName database name. - * @param tblName table name. - * @param name - partition name i.e. 'ds=2010-02-03/ts=2010-02-03 18%3A16%3A01' - * @return the partition object - * @throws MetaException error access the RDBMS. - * @throws TException thrift transport error - */ - Partition getPartition(String catName, String dbName, String tblName, String name) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; - - - /** - * Get a Partition along with authorization information. - * @param dbName database name - * @param tableName table name - * @param pvals partition values, must be in the same order as the tables partition keys - * @param userName name of the calling user - * @param groupNames groups the call - * @return the partition - * @throws MetaException error accessing the RDBMS - * @throws UnknownTableException no such table - * @throws NoSuchObjectException no such partition - * @throws TException thrift transport error - */ - Partition getPartitionWithAuthInfo(String dbName, String tableName, - List<String> pvals, String userName, List<String> groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; - - /** - * Get a Partition along with authorization information. - * @param catName catalog name - * @param dbName database name - * @param tableName table name - * @param pvals partition values, must be in the same order as the tables partition keys - * @param userName name of the calling user - * @param groupNames groups the call - * @return the partition - * @throws MetaException error accessing the RDBMS - * @throws UnknownTableException no such table - * @throws NoSuchObjectException no such partition - * @throws TException thrift transport error - */ - Partition getPartitionWithAuthInfo(String catName, String dbName, String tableName, - List<String> pvals, String userName, List<String> groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; - - /** - * Get a list of partittions for a table. - * @param db_name database name - * @param tbl_name table name - * @param max_parts maximum number of parts to return, -1 for all - * @return the list of partitions - * @throws NoSuchObjectException No such table. - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<Partition> listPartitions(String db_name, String tbl_name, short max_parts) - throws NoSuchObjectException, MetaException, TException; - - /** - * Get a list of partittions for a table. - * @param catName catalog name - * @param db_name database name - * @param tbl_name table name - * @param max_parts maximum number of parts to return, -1 for all - * @return the list of partitions - * @throws NoSuchObjectException No such table. - * @throws MetaException error accessing RDBMS. - * @throws TException thrift transport error - */ - List<Partition> listPartitions(String catName, String db_name, String tbl_name, int max_parts) - throws NoSuchObjectException, MetaException, TException; - - /** - * Get a list of partitions from a table, returned in the form of PartitionSpecProxy - * @param dbName database name. - * @param tableName table name. - * @param maxParts maximum number of partitions to return, or -1 for all - * @return a PartitionSpecProxy - * @throws TException thrift transport error - */ - PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, int maxParts) - throws TException; - - /** - * Get a list of partitions from a table, returned in the form of PartitionSpecProxy - * @param catName catalog name. - * @param dbName database name. - * @param tableName table name. - * @param maxParts maximum number of partitions to return, or -1 for all - * @return a PartitionSpecProxy - * @throws TException thrift transport error - */ - PartitionSpecProxy listPartitionSpecs(String catName, String dbName, String tableName, - int maxParts) throws TException; - - /** - * Get a list of partitions based on a (possibly partial) list of partition values. - * @param db_name database name. - * @param tbl_name table name. - * @param part_vals partition values, in order of the table partition keys. These can be - * partial, or .* to match all values for a particular key. - * @param max_parts maximum number of partitions to return, or -1 for all. - * @return list of partitions - * @throws NoSuchObjectException no such table. - * @throws MetaException error accessing the database or processing the partition values. - * @throws TException thrift transport error. - */ - List<Partition> listPartitions(String db_name, String tbl_name, - List<String> part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException; - - /** - * Get a list of partitions based on a (possibly partial) list of partition values. - * @param catName catalog name. - * @param db_name database name. - * @param tbl_name table name. - * @param part_vals partition values, in order of the table partition keys. These can be - * partial, or .* to match all values for a particular key. - * @param max_parts maximum number of partitions to return, or -1 for all. - * @return list of partitions - * @throws NoSuchObjectException no such table. - * @throws MetaException error accessing the database or processing the partition values. - * @throws TException thrift transport error. - */ - List<Partition> listPartitions(String catName, String db_name, String tbl_name, - List<String> part_vals, int max_parts) - throws NoSuchObjectException, MetaException, TException; - - /** - * List Names of partitions in a table. - * @param db_name database name. - * @param tbl_name table name. - * @param max_parts maximum number of parts of fetch, or -1 to fetch them all. - * @return list of partition names. - * @throws NoSuchObjectException No such table. - * @throws MetaException Error accessing the RDBMS. - * @throws TException thrift transport error - */ - List<String> listPartitionNames(String db_name, String tbl_name, - short max_parts) throws NoSuchObjectException, MetaException, TException; - - /** - * List Names of partitions in a table. - * @param catName catalog name. - * @param db_name database name. - * @param tbl_name table name. - * @param max_parts maximum number of parts of fetch, or -1 to fetch them all. - * @return list of partition names. - * @throws NoSuchObjectException No such table. - * @throws MetaException Error accessing the RDBMS. - * @throws TException thrift transport error - */ - List<String> listPartitionNames(String catName, String db_name, String tbl_name, - int max_parts) throws NoSuchObjectException, MetaException, TException; - - /** - * Get a list of partition names matching a partial specification of the partition values. - * @param db_name database name. - * @param tbl_name table name. - * @param part_vals partial list of partition values. These must be given in the order of the - * partition keys. If you wish to accept any value for a particular key you - * can pass ".*" for that value in this list. - * @param max_parts maximum number of partition names to return, or -1 to return all that are - * found. - * @return list of matching partition names. - * @throws MetaException error accessing the RDBMS. - * @throws TException thrift transport error. - * @throws NoSuchObjectException no such table. - */ - List<String> listPartitionNames(String db_name, String tbl_name, - List<String> part_vals, short max_parts) - throws MetaException, TException, NoSuchObjectException; - - /** - * Get a list of partition names matching a partial specification of the partition values. - * @param catName catalog name. - * @param db_name database name. - * @param tbl_name table name. - * @param part_vals partial list of partition values. These must be given in the order of the - * partition keys. If you wish to accept any value for a particular key you - * can pass ".*" for that value in this list. - * @param max_parts maximum number of partition names to return, or -1 to return all that are - * found. - * @return list of matching partition names. - * @throws MetaException error accessing the RDBMS. - * @throws TException thrift transport error. - * @throws NoSuchObjectException no such table. - */ - List<String> listPartitionNames(String catName, String db_name, String tbl_name, - List<String> part_vals, int max_parts) - throws MetaException, TException, NoSuchObjectException; - - /** - * Get a list of partition values - * @param request request - * @return reponse - * @throws MetaException error accessing RDBMS - * @throws TException thrift transport error - * @throws NoSuchObjectException no such table - */ - PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) - throws MetaException, TException, NoSuchObjectException; - - /** - * Get number of partitions matching specified filter - * @param dbName the database name - * @param tableName the table name - * @param filter the filter string, - * for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can - * be done only on string partition keys. - * @return number of partitions - * @throws MetaException error accessing RDBMS or processing the filter - * @throws NoSuchObjectException no such table - * @throws TException thrift transport error - */ - int getNumPartitionsByFilter(String dbName, String tableName, - String filter) throws MetaException, NoSuchObjectException, TException; - - /** - * Get number of partitions matching specified filter - * @param catName catalog name - * @param dbName the database name - * @param tableName the table name - * @param filter the filter string, - * for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can - * be done only on string partition keys. - * @return number of partitions - * @throws MetaException error accessing RDBMS or processing the filter - * @throws NoSuchObjectException no such table - * @throws TException thrift transport error - */ - int getNumPartitionsByFilter(String catName, String dbName, String tableName, - String filter) throws MetaException, NoSuchObjectException, TException; - - - /** - * Get list of partitions matching specified filter - * @param db_name the database name - * @param tbl_name the table name - * @param filter the filter string, - * for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can - * be done only on string partition keys. - * @param max_parts the maximum number of partitions to return, - * all partitions are returned if -1 is passed - * @return list of partitions - * @throws MetaException Error accessing the RDBMS or processing the filter. - * @throws NoSuchObjectException No such table. - * @throws TException thrift transport error - */ - List<Partition> listPartitionsByFilter(String db_name, String tbl_name, - String filter, short max_parts) throws MetaException, NoSuchObjectException, TException; - - /** - * Get list of partitions matching specified filter - * @param catName catalog name. - * @param db_name the database name - * @param tbl_name the table name - * @param filter the filter string, - * for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can - * be done only on string partition keys. - * @param max_parts the maximum number of partitions to return, - * all partitions are returned if -1 is passed - * @return list of partitions - * @throws MetaException Error accessing the RDBMS or processing the filter. - * @throws NoSuchObjectException No such table. - * @throws TException thrift transport error - */ - List<Partition> listPartitionsByFilter(String catName, String db_name, String tbl_name, - String filter, int max_parts) - throws MetaException, NoSuchObjectException, TException; - - /** - * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to - * fetch. - * @param db_name database name - * @param tbl_name table name - * @param filter SQL where clause filter - * @param max_parts maximum number of partitions to fetch, or -1 for all - * @return PartitionSpec - * @throws MetaException error accessing RDBMS or processing the filter - * @throws NoSuchObjectException No table matches the request - * @throws TException thrift transport error - */ - PartitionSpecProxy listPartitionSpecsByFilter(String db_name, String tbl_name, - String filter, int max_parts) - throws MetaException, NoSuchObjectException, TException; - - /** - * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to - * fetch. - * @param catName catalog name - * @param db_name database name - * @param tbl_name table name - * @param filter SQL where clause filter - * @param max_parts maximum number of partitions to fetch, or -1 for all - * @return PartitionSpec - * @throws MetaException error accessing RDBMS or processing the filter - * @throws NoSuchObjectException No table matches the request - * @throws TException thrift transport error - */ - PartitionSpecProxy listPartitionSpecsByFilter(String catName, String db_name, String tbl_name, - String filter, int max_parts) - throws MetaException, NoSuchObjectException, TException; - - /** - * Get list of partitions matching specified serialized expression - * @param db_name the database name - * @param tbl_name the table name - * @param expr expression, serialized from ExprNodeDesc - * @param max_parts the maximum number of partitions to return, - * all partitions are returned if -1 is passed - * @param default_partition_name Default partition name from configuration. If blank, the - * metastore server-side configuration is used. - * @param result the resulting list of partitions - * @return whether the resulting list contains partitions which may or may not match the expr - * @throws TException thrift transport error or error executing the filter. - */ - boolean listPartitionsByExpr(String db_name, String tbl_name, - byte[] expr, String default_partition_name, short max_parts, List<Partition> result) - throws TException; - - /** - * Get list of partitions matching specified serialized expression - * @param catName catalog name - * @param db_name the database name - * @param tbl_name the table name - * @param expr expression, serialized from ExprNodeDesc - * @param max_parts the maximum number of partitions to return, - * all partitions are returned if -1 is passed - * @param default_partition_name Default partition name from configuration. If blank, the - * metastore server-side configuration is used. - * @param result the resulting list of partitions - * @return whether the resulting list contains partitions which may or may not match the expr - * @throws TException thrift transport error or error executing the filter. - */ - boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, byte[] expr, - String default_partition_name, int max_parts, List<Partition> result) - throws TException; - - /** - * List partitions, fetching the authorization information along with the partitions. - * @param dbName database name - * @param tableName table name - * @param maxParts maximum number of partitions to fetch, or -1 for all - * @param userName user to fetch privileges for - * @param groupNames groups to fetch privileges for - * @return the list of partitions - * @throws NoSuchObjectException no partitions matching the criteria were found - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - List<Partition> listPartitionsWithAuthInfo(String dbName, - String tableName, short maxParts, String userName, List<String> groupNames) - throws MetaException, TException, NoSuchObjectException; - - /** - * List partitions, fetching the authorization information along with the partitions. - * @param catName catalog name - * @param dbName database name - * @param tableName table name - * @param maxParts maximum number of partitions to fetch, or -1 for all - * @param userName user to fetch privileges for - * @param groupNames groups to fetch privileges for - * @return the list of partitions - * @throws NoSuchObjectException no partitions matching the criteria were found - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - List<Partition> listPartitionsWithAuthInfo(String catName, String dbName, String tableName, - int maxParts, String userName, List<String> groupNames) - throws MetaException, TException, NoSuchObjectException; - - /** - * Get partitions by a list of partition names. - * @param db_name database name - * @param tbl_name table name - * @param part_names list of partition names - * @return list of Partition objects - * @throws NoSuchObjectException No such partitions - * @throws MetaException error accessing the RDBMS. - * @throws TException thrift transport error - */ - List<Partition> getPartitionsByNames(String db_name, String tbl_name, - List<String> part_names) throws NoSuchObjectException, MetaException, TException; - - /** - * Get partitions by a list of partition names. - * @param catName catalog name - * @param db_name database name - * @param tbl_name table name - * @param part_names list of partition names - * @return list of Partition objects - * @throws NoSuchObjectException No such partitions - * @throws MetaException error accessing the RDBMS. - * @throws TException thrift transport error - */ - List<Partition> getPartitionsByNames(String catName, String db_name, String tbl_name, - List<String> part_names) - throws NoSuchObjectException, MetaException, TException; - - /** - * List partitions along with privilege information for a user or groups - * @param dbName database name - * @param tableName table name - * @param partialPvals partition values, can be partial - * @param maxParts maximum number of partitions to fetch, or -1 for all - * @param userName user to fetch privilege information for - * @param groupNames group to fetch privilege information for - * @return the list of partitions - * @throws NoSuchObjectException no partitions matching the criteria were found - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - List<Partition> listPartitionsWithAuthInfo(String dbName, - String tableName, List<String> partialPvals, short maxParts, String userName, - List<String> groupNames) throws MetaException, TException, NoSuchObjectException; - - /** - * List partitions along with privilege information for a user or groups - * @param dbName database name - * @param tableName table name - * @param partialPvals partition values, can be partial - * @param maxParts maximum number of partitions to fetch, or -1 for all - * @param userName user to fetch privilege information for - * @param groupNames group to fetch privilege information for - * @return the list of partitions - * @throws NoSuchObjectException no partitions matching the criteria were found - * @throws MetaException error accessing the RDBMS - * @throws TException thrift transport error - */ - List<Partition> listPartitionsWithAuthInfo(String catName, String dbName, String tableName, - List<String> partialPvals, int maxParts, String userName, - List<String> groupNames) - throws MetaException, TException, NoSuchObjectException; - - /** - * Mark an event as having occurred on a partition. - * @param db_name database name - * @param tbl_name table name - * @param partKVs key value pairs that describe the partition - * @param eventType type of the event - * @throws MetaException error access the RDBMS - * @throws NoSuchObjectException never throws this AFAICT - * @throws TException thrift transport error - * @throws UnknownTableException no such table - * @throws UnknownDBException no such database - * @throws UnknownPartitionException no such partition - * @throws InvalidPartitionException partition partKVs is invalid - */ - void markPartitionForEvent(String db_name, String tbl_name, Map<String,String> partKVs, - PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; - - /** - * Mark an event as having occurred on a partition. - * @param catName catalog name - * @param db_name database name - * @param tbl_name table name - * @param partKVs key value pairs that describe the partition - * @param eventType type of the event - * @throws MetaException error access the RDBMS - * @throws NoSuchObjectException never throws this AFAICT - * @throws TException thrift transport error - * @throws UnknownTableException no such table - * @throws UnknownDBException no such database - * @throws UnknownPartitionException no such partition - * @throws InvalidPartitionException partition partKVs is invalid - */ - void markPartitionForEvent(String catName, String db_name, String tbl_name, Map<String,String> partKVs, - PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; - - /** - * Determine whether a partition has been marked with a particular event type. - * @param db_name database name - * @param tbl_name table name. - * @param partKVs key value pairs that describe the partition. - * @param eventType event type - * @throws MetaException error access the RDBMS - * @throws NoSuchObjectException never throws this AFAICT - * @throws TException thrift transport error - * @throws UnknownTableException no such table - * @throws UnknownDBException no such database - * @throws UnknownPartitionException no such partition - * @throws InvalidPartitionException partition partKVs is invalid - */ - boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map<String,String> partKVs, - PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; - - /** - * Determine whether a partition has been marked with a particular event type. - * @param catName catalog name - * @param db_name database name - * @param tbl_name table name. - * @param partKVs key value pairs that describe the partition. - * @param eventType event type - * @throws MetaException error access the RDBMS - * @throws NoSuchObjectException never throws this AFAICT - * @throws TException thrift transport error - * @throws UnknownTableException no such table - * @throws UnknownDBException no such database - * @throws UnknownPartitionException no such partition - * @throws InvalidPartitionException partition partKVs is invalid - */ - boolean isPartitionMarkedForEvent(String catName, String db_name, String tbl_name, Map<String,String> partKVs, - PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; - - /** - * @param partVals - * @throws TException - * @throws MetaException - */ - void validatePartitionNameCharacters(List<String> partVals) throws TException, MetaException; - - /** - * @param tbl - * @throws AlreadyExistsException - * @throws InvalidObjectException - * @throws MetaException - * @throws NoSuchObjectException - * @throws TException - * @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#create_table(org.apache.hadoop.hive.metastore.api.Table) - */ - - void createTable(Table tbl) throws AlreadyExistsException, - InvalidObjectException, MetaException, NoSuchObjectException, TException; - - /** - * Alter a table - * @param databaseName database name - * @param tblName table name - * @param table new table object, should be complete representation of the table, not just the - * things you want to change. - * @throws InvalidOperationException something is wrong with the new table object or an - * operation was attempted that is not allowed (such as changing partition columns). - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift exception - */ - void alter_table(String databaseName, String tblName, Table table) - throws InvalidOperationException, MetaException, TException; - - /** - * Alter a table. Equivalent to - * {@link #alter_table(String, String, String, Table, EnvironmentContext)} with - * EnvironmentContext set to null. - * @param catName catalog name. - * @param dbName database name. - * @param tblName table name. - * @param newTable new table object, should be complete representation of the table, not just the - * things you want to change. - * @throws InvalidOperationException something is wrong with the new table object or an - * operation was attempted that is not allowed (such as changing partition columns). - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift exception - */ - default void alter_table(String catName, String dbName, String tblName, Table newTable) - throws InvalidOperationException, MetaException, TException { - alter_table(catName, dbName, tblName, newTable, null); - } - - /** - * Alter a table. - * @param catName catalog name. - * @param dbName database name. - * @param tblName table name. - * @param newTable new table object, should be complete representation of the table, not just the - * things you want to change. - * @param envContext options for the alter. - * @throws InvalidOperationException something is wrong with the new table object or an - * operation was attempted that is not allowed (such as changing partition columns). - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift exception - */ - void alter_table(String catName, String dbName, String tblName, Table newTable, - EnvironmentContext envContext) - throws InvalidOperationException, MetaException, TException; - - /** - * @deprecated Use alter_table_with_environmentContext instead of alter_table with cascade option - * passed in EnvironmentContext using {@code StatsSetupConst.CASCADE} - */ - @Deprecated - void alter_table(String defaultDatabaseName, String tblName, Table table, - boolean cascade) throws InvalidOperationException, MetaException, TException; - - /** - * Alter a table. - * @param databaseName database name - * @param tblName table name - * @param table new table object, should be complete representation of the table, not just the - * things you want to change. - * @param environmentContext options for the alter. - * @throws InvalidOperationException something is wrong with the new table object or an - * operation was attempted that is not allowed (such as changing partition columns). - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift exception - */ - @Deprecated - void alter_table_with_environmentContext(String databaseName, String tblName, Table table, - EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, - TException; - - void alter_table(String catName, String databaseName, String tblName, Table table, - EnvironmentContext environmentContext, String validWriteIdList) - throws InvalidOperationException, MetaException, TException; - /** - * Create a new database. - * @param db database object. If the catalog name is null it will be assumed to be - * {@link Warehouse#DEFAULT_CATALOG_NAME}. - * @throws InvalidObjectException There is something wrong with the database object. - * @throws AlreadyExistsException There is already a database of this name in the specified - * catalog. - * @throws MetaException something went wrong, usually in the RDBMS - * @throws TException general thrift error - */ - void createDatabase(Database db) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; - - /** - * Drop a database. - * @param name name of the database to drop. - * @throws NoSuchObjectException No such database exists. - * @throws InvalidOperationException The database cannot be dropped because it is not empty. - * @throws MetaException something went wrong, usually either in the RDMBS or in storage. - * @throws TException general thrift error. - */ - void dropDatabase(String name) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; - - /** - * - * Drop a database. - * @param name name of the database to drop. - * @param deleteData whether to drop the underlying HDFS directory. - * @param ignoreUnknownDb whether to ignore an attempt to drop a non-existant database - * @throws NoSuchObjectException No database of this name exists in the specified catalog and - * ignoreUnknownDb is false. - * @throws InvalidOperationException The database cannot be dropped because it is not empty. - * @throws MetaException something went wrong, usually either in the RDMBS or in storage. - * @throws TException general thrift error. - */ - void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; - - /** - * - * Drop a database. - * @param name database name. - * @param deleteData whether to drop the underlying HDFS directory. - * @param ignoreUnknownDb whether to ignore an attempt to drop a non-existant database - * @param cascade whether to drop contained tables, etc. If this is false and there are - * objects still in the database the drop will fail. - * @throws NoSuchObjectException No database of this name exists in the specified catalog and - * ignoreUnknownDb is false. - * @throws InvalidOperationException The database contains objects and cascade is false. - * @throws MetaException something went wrong, usually either in the RDBMS or storage. - * @throws TException general thrift error. - */ - void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; - - /** - * Drop a database. - * @param catName Catalog name. This can be null, in which case - * {@link Warehouse#DEFAULT_CATALOG_NAME} will be assumed. - * @param dbName database name. - * @param deleteData whether to drop the underlying HDFS directory. - * @param ignoreUnknownDb whether to ignore an attempt to drop a non-existant database - * @param cascade whether to drop contained tables, etc. If this is false and there are - * objects still in the database the drop will fail. - * @throws NoSuchObjectException No database of this name exists in the specified catalog and - * ignoreUnknownDb is false. - * @throws InvalidOperationException The database contains objects and cascade is false. - * @throws MetaException something went wrong, usually either in the RDBMS or storage. - * @throws TException general thrift error. - */ - void dropDatabase(String catName, String dbName, boolean deleteData, boolean ignoreUnknownDb, - boolean cascade) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; - - /** - * Drop a database. Equivalent to - * {@link #dropDatabase(String, String, boolean, boolean, boolean)} with cascade = false. - * @param catName Catalog name. This can be null, in which case - * {@link Warehouse#DEFAULT_CATALOG_NAME} will be assumed. - * @param dbName database name. - * @param deleteData whether to drop the underlying HDFS directory. - * @param ignoreUnknownDb whether to ignore an attempt to drop a non-existant database - * @throws NoSuchObjectException No database of this name exists in the specified catalog and - * ignoreUnknownDb is false. - * @throws InvalidOperationException The database contains objects and cascade is false. - * @throws MetaException something went wrong, usually either in the RDBMS or storage. - * @throws TException general thrift error. - */ - default void dropDatabase(String catName, String dbName, boolean deleteData, - boolean ignoreUnknownDb) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException { - dropDatabase(catName, dbName, deleteData, ignoreUnknownDb, false); - } - - /** - * Drop a database. Equivalent to - * {@link #dropDatabase(String, String, boolean, boolean, boolean)} with deleteData = - * true, ignoreUnknownDb = false, cascade = false. - * @param catName Catalog name. This can be null, in which case - * {@link Warehouse#DEFAULT_CATALOG_NAME} will be assumed. - * @param dbName database name. - * @throws NoSuchObjectException No database of this name exists in the specified catalog and - * ignoreUnknownDb is false. - * @throws InvalidOperationException The database contains objects and cascade is false. - * @throws MetaException something went wrong, usually either in the RDBMS or storage. - * @throws TException general thrift error. - */ - default void dropDatabase(String catName, String dbName) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException { - dropDatabase(catName, dbName, true, false, false); - } - - - /** - * Alter a database. - * @param name database name. - * @param db new database object. - * @throws NoSuchObjectException No database of this name exists in the specified catalog. - * @throws MetaException something went wrong, usually in the RDBMS. - * @throws TException general thrift error. - */ - void alterDatabase(String name, Database db) - throws NoSuchObjectException, MetaException, TException; - - /** - * Alter a database. - * @param catName Catalog name. This can be null, in which case - * {@link Warehouse#DEFAULT_CATALOG_NAME} will be assumed. - * @param dbName database name. - * @param newDb new database object. - * @throws NoSuchObjectException No database of this name exists in the specified catalog. - * @throws MetaException something went wrong, usually in the RDBMS. - * @throws TException general thrift error. - */ - void alterDatabase(String catName, String dbName, Database newDb) - throws NoSuchObjectException, MetaException, TException; - - /** - * Drop a partition. - * @param db_name database name - * @param tbl_name table name - * @param part_vals partition values, in the same order as the partition keys - * @param deleteData - * delete the underlying data or just delete the partition in metadata - * @return true or false - * @throws NoSuchObjectException partition does not exist - * @throws MetaException error accessing the RDBMS or the storage. - * @throws TException thrift transport error - */ - boolean dropPartition(String db_name, String tbl_name, - List<String> part_vals, boolean deleteData) throws NoSuchObjectException, - MetaException, TException; - - /** - * Drop a partition. - * @param catName catalog name. - * @param db_name database name - * @param tbl_name table name - * @param part_vals partition values, in the same order as the partition keys - * @param deleteData - * delete the underlying data or just delete the partition in metadata - * @return true or false - * @throws NoSuchObjectException partition does not exist - * @throws MetaException error accessing the RDBMS or the storage. - * @throws TException thrift transport error - */ - boolean dropPartition(String catName, String db_name, String tbl_name, - List<String> part_vals, boolean deleteData) throws NoSuchObjectException, - MetaException, TException; - - /** - * Drop a partition with the option to purge the partition data directly, - * rather than to move data to trash. - * @param db_name Name of the database. - * @param tbl_name Name of the table. - * @param part_vals Specification of the partitions being dropped. - * @param options PartitionDropOptions for the operation. - * @return True (if partitions are dropped), else false. - * @throws NoSuchObjectException partition does not exist - * @throws MetaException error accessing the RDBMS or the storage. - * @throws TException thrift transport error. - */ - boolean dropPartition(String db_name, String tbl_name, List<String> part_vals, - PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; - - /** - * Drop a partition with the option to purge the partition data directly, - * rather than to move data to trash. - * @param catName catalog name. - * @param db_name Name of the database. - * @param tbl_name Name of the table. - * @param part_vals Specification of the partitions being dropped. - * @param options PartitionDropOptions for the operation. - * @return True (if partitions are dropped), else false. - * @throws NoSuchObjectException partition does not exist - * @throws MetaException error accessing the RDBMS or the storage. - * @throws TException thrift transport error. - */ - boolean dropPartition(String catName, String db_name, String tbl_name, List<String> part_vals, - PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; - - /** - * Drop partitions based on an expression. - * @param dbName database name. - * @param tblName table name. - * @param partExprs I don't und
<TRUNCATED>
