From c03d90e31797a5dd7a3b70d49a2510e1e406340d Mon Sep 17 00:00:00 2001 From: Zoltan Ratkai Date: Fri, 31 Jan 2025 18:04:35 +0100 Subject: [PATCH 1/3] HIVE-28658 Add Iceberg REST Catalog client support Change-Id: I803b1d1b523a4e77116b0227324afaaa7acf659f --- README.md | 48 + iceberg/iceberg-catalog/pom.xml | 1 - .../iceberg/hive/HMSTablePropertyHelper.java | 122 +- .../HiveIcebergRESTCatalogClientAdapter.java | 442 +++++ ...stHiveIcebergRESTCatalogClientAdapter.java | 187 +++ .../java/org/apache/iceberg/mr/Catalogs.java | 14 +- .../iceberg/mr/hive/HiveIcebergMetaHook.java | 2 +- .../mr/hive/HiveIcebergStorageHandler.java | 3 +- .../iceberg/mr/hive/IcebergTableUtil.java | 48 +- iceberg/pom.xml | 15 + pom.xml | 17 + ql/pom.xml | 12 + .../apache/hadoop/hive/ql/metadata/Hive.java | 21 +- .../ql/metadata/IMetaStoreClientFactory.java | 78 + .../hive/metastore/IMetaStoreClient.java | 1472 +++++++++++------ standalone-metastore/pom.xml | 2 + 16 files changed, 1882 insertions(+), 602 deletions(-) create mode 100644 iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java create mode 100644 iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java create mode 100644 ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java diff --git a/README.md b/README.md index 7a2f82c9fd85..f75d9a257174 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,54 @@ Upgrading from older versions of Hive different database for your MetaStore you will need to provide your own upgrade script. +Using Iceberg REST catalog +========================== +To enable Apache Iceberg REST catalog usage add the followings in hive-site.xml + + + iceberg.catalog + rest + + + iceberg.catalog.rest.type + rest + + + iceberg.catalog.rest.uri + {restServerUrl} + + + metastore.type + rest + + +For OAUTH2 authentication add this as well: + + + iceberg.catalog.rest.security + OAUTH2 + + + iceberg.catalog.rest.credential + {user:pass} + + + iceberg.catalog.rest.scope + PRINCIPAL_ROLE:ALL + + + iceberg.catalog.rest.oauth2.credential + {user:pass} + + + iceberg.catalog.rest.oauth2.scope + PRINCIPAL_ROLE:ALL + + + iceberg.catalog.rest.warehouse + {catalogName} + + Useful mailing lists ==================== diff --git a/iceberg/iceberg-catalog/pom.xml b/iceberg/iceberg-catalog/pom.xml index fb11670b389e..d5512859f4ae 100644 --- a/iceberg/iceberg-catalog/pom.xml +++ b/iceberg/iceberg-catalog/pom.xml @@ -69,7 +69,6 @@ org.apache.hive hive-exec - test org.immutables diff --git a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java index 2eaaaee1272e..21e0667aa8d4 100644 --- a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HMSTablePropertyHelper.java @@ -19,29 +19,40 @@ package org.apache.iceberg.hive; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Optional; +import java.util.Properties; import java.util.Set; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.common.StatsSetupConst; +import org.apache.hadoop.hive.metastore.api.SerDeInfo; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.ql.parse.TransformSpec; +import org.apache.hadoop.hive.ql.session.SessionStateUtil; import org.apache.hive.iceberg.com.fasterxml.jackson.core.JsonProcessingException; import org.apache.iceberg.BaseMetastoreTableOperations; +import org.apache.iceberg.PartitionSpec; import org.apache.iceberg.PartitionSpecParser; import org.apache.iceberg.Schema; import org.apache.iceberg.SchemaParser; import org.apache.iceberg.Snapshot; import org.apache.iceberg.SnapshotSummary; +import org.apache.iceberg.SortOrder; import org.apache.iceberg.SortOrderParser; import org.apache.iceberg.TableMetadata; import org.apache.iceberg.TableProperties; +import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; import org.apache.iceberg.relocated.com.google.common.collect.BiMap; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableBiMap; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet; import org.apache.iceberg.relocated.com.google.common.collect.Maps; import org.apache.iceberg.util.JsonUtil; +import org.apache.parquet.Strings; import org.apache.parquet.hadoop.ParquetOutputFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +69,15 @@ public class HMSTablePropertyHelper { GC_ENABLED, "external.table.purge", TableProperties.PARQUET_COMPRESSION, ParquetOutputFormat.COMPRESSION, TableProperties.PARQUET_ROW_GROUP_SIZE_BYTES, ParquetOutputFormat.BLOCK_SIZE); + public static final Set PROPERTIES_TO_REMOVE = ImmutableSet + // We don't want to push down the metadata location props to Iceberg from HMS, + // since the snapshot pointer in HMS would always be one step ahead + .of(BaseMetastoreTableOperations.METADATA_LOCATION_PROP, + BaseMetastoreTableOperations.PREVIOUS_METADATA_LOCATION_PROP); + + public static final String NAME = "name"; + public static final String LOCATION = "location"; + private HMSTablePropertyHelper() { } @@ -131,6 +151,103 @@ public static void updateHmsTableForIcebergTable( tbl.setParameters(parameters); } + /** + * Create {@link PartitionSpec} based on the partition information stored in + * {@link TransformSpec}. + * @param configuration a Hadoop configuration + * @param schema iceberg table schema + * @return iceberg partition spec, always non-null + */ + public static PartitionSpec createPartitionSpec(Configuration configuration, Schema schema) { + List partitionTransformSpecList = SessionStateUtil + .getResource(configuration, hive_metastoreConstants.PARTITION_TRANSFORM_SPEC) + .map(o -> (List) o) + .orElse(null); + + if (partitionTransformSpecList == null) { + LOG.warn("Iceberg partition transform spec is not found in QueryState."); + return null; + } + PartitionSpec.Builder builder = PartitionSpec.builderFor(schema); + partitionTransformSpecList.forEach(spec -> { + switch (spec.getTransformType()) { + case IDENTITY: + builder.identity(spec.getColumnName().toLowerCase()); + break; + case YEAR: + builder.year(spec.getColumnName()); + break; + case MONTH: + builder.month(spec.getColumnName()); + break; + case DAY: + builder.day(spec.getColumnName()); + break; + case HOUR: + builder.hour(spec.getColumnName()); + break; + case TRUNCATE: + builder.truncate(spec.getColumnName(), spec.getTransformParam().get()); + break; + case BUCKET: + builder.bucket(spec.getColumnName(), spec.getTransformParam().get()); + break; + } + }); + return builder.build(); + } + + public static SortOrder getSortOrder(Properties props, Schema schema) { + String sortOrderJsonString = props.getProperty(TableProperties.DEFAULT_SORT_ORDER); + return Strings.isNullOrEmpty(sortOrderJsonString) ? SortOrder.unsorted() : SortOrderParser.fromJson(schema, + sortOrderJsonString); + } + + /** + * Calculates the properties we would like to send to the catalog. + *
    + *
  • The base of the properties is the properties stored at the Hive Metastore for the given table + *
  • We add the {@link HiveIcebergRESTCatalogClientAdapter#LOCATION} as the table location + *
  • We add the {@link HiveIcebergRESTCatalogClientAdapter#NAME} as + * TableIdentifier defined by the database name and table name + *
  • We add the serdeProperties of the HMS table + *
  • We remove some parameters that we don't want to push down to the Iceberg table props + *
+ * @param hmsTable Table for which we are calculating the properties + * @return The properties we can provide for Iceberg functions + */ + public static Properties getCatalogProperties(org.apache.hadoop.hive.metastore.api.Table hmsTable) { + Properties properties = new Properties(); + + hmsTable.getParameters().entrySet().stream().filter(e -> e.getKey() != null && e.getValue() != null).forEach(e -> { + // translate key names between HMS and Iceberg where needed + String icebergKey = HMSTablePropertyHelper.translateToIcebergProp(e.getKey()); + properties.put(icebergKey, e.getValue()); + }); + + if (properties.get(LOCATION) == null && + hmsTable.getSd() != null && hmsTable.getSd().getLocation() != null) { + properties.put(LOCATION, hmsTable.getSd().getLocation()); + } + + if (properties.get(NAME) == null) { + properties.put(NAME, TableIdentifier.of(hmsTable.getDbName(), hmsTable.getTableName()).toString()); + } + + SerDeInfo serdeInfo = hmsTable.getSd().getSerdeInfo(); + if (serdeInfo != null) { + serdeInfo.getParameters().entrySet().stream() + .filter(e -> e.getKey() != null && e.getValue() != null).forEach(e -> { + String icebergKey = HMSTablePropertyHelper.translateToIcebergProp(e.getKey()); + properties.put(icebergKey, e.getValue()); + }); + } + + // Remove HMS table parameters we don't want to propagate to Iceberg + PROPERTIES_TO_REMOVE.forEach(properties::remove); + + return properties; + } private static void setCommonParameters( String newMetadataLocation, String uuid, @@ -143,8 +260,9 @@ private static void setCommonParameters( if (uuid != null) { parameters.put(TableProperties.UUID, uuid); } - - obsoleteProps.forEach(parameters::remove); + if (obsoleteProps != null) { + obsoleteProps.forEach(parameters::remove); + } parameters.put(BaseMetastoreTableOperations.TABLE_TYPE_PROP, tableType); parameters.put(BaseMetastoreTableOperations.METADATA_LOCATION_PROP, newMetadataLocation); diff --git a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java new file mode 100644 index 000000000000..6737fe5e34b3 --- /dev/null +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java @@ -0,0 +1,442 @@ +/* + * 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.iceberg.hive; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.stream.Collectors; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.metastore.HiveMetaHook; +import org.apache.hadoop.hive.metastore.HiveMetaHookLoader; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.TableType; +import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; +import org.apache.hadoop.hive.metastore.api.CompactionMetricsDataStruct; +import org.apache.hadoop.hive.metastore.api.CreateTableRequest; +import org.apache.hadoop.hive.metastore.api.Database; +import org.apache.hadoop.hive.metastore.api.DropDatabaseRequest; +import org.apache.hadoop.hive.metastore.api.FieldSchema; +import org.apache.hadoop.hive.metastore.api.GetTableRequest; +import org.apache.hadoop.hive.metastore.api.InvalidObjectException; +import org.apache.hadoop.hive.metastore.api.InvalidOperationException; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; +import org.apache.hadoop.hive.metastore.api.PrincipalType; +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.SerDeInfo; +import org.apache.hadoop.hive.metastore.api.ShowLocksResponse; +import org.apache.hadoop.hive.metastore.api.StorageDescriptor; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.hadoop.hive.metastore.api.UnknownDBException; +import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan; +import org.apache.hadoop.hive.serde.serdeConstants; +import org.apache.iceberg.BaseTable; +import org.apache.iceberg.CatalogUtil; +import org.apache.iceberg.Schema; +import org.apache.iceberg.SortOrder; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.catalog.SessionCatalog; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.exceptions.NoSuchTableException; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.rest.RESTCatalog; +import org.apache.thrift.TException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HiveIcebergRESTCatalogClientAdapter implements IMetaStoreClient { + + private static final Logger LOG = LoggerFactory.getLogger(HiveIcebergRESTCatalogClientAdapter.class); + public static final String NAMESPACE_SEPARATOR = "."; + public static final String NAME = "name"; + public static final String LOCATION = "location"; + public static final String CATALOG_NAME = "iceberg.catalog"; + public static final String DB_OWNER = "owner"; + public static final String DB_OWNER_TYPE = "ownerType"; + public static final String DEFAULT_INPUT_FORMAT_CLASS = "org.apache.iceberg.mr.hive.HiveIcebergInputFormat"; + public static final String DEFAULT_OUTPUT_FORMAT_CLASS + = "org.apache.iceberg.mr.hive.HiveIcebergOutputFormat"; + public static final String DEFAULT_SERDE_CLASS = "org.apache.iceberg.mr.hive.HiveIcebergSerDe"; + public static final String CATALOG_CONFIG_PREFIX = "iceberg.catalog."; + private final Configuration conf; + private RESTCatalog restCatalog; + private final HiveMetaHookLoader hookLoader; + + private final long maxHiveTablePropertySize; + + public HiveIcebergRESTCatalogClientAdapter(Configuration conf, HiveMetaHookLoader hookLoader) { + this.conf = conf; + this.hookLoader = hookLoader; + this.maxHiveTablePropertySize = conf.getLong(HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE, + HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE_DEFAULT); + } + + @Override + public void reconnect() throws MetaException { + SessionCatalog.SessionContext context = SessionCatalog.SessionContext.createEmpty(); + String catalogName = conf.get(CATALOG_NAME); + Map properties = getCatalogPropertiesFromConf(conf, catalogName); + restCatalog = (RESTCatalog) CatalogUtil.buildIcebergCatalog(catalogName, properties, conf); + restCatalog.initialize(catalogName, properties); + } + + @Override + public void close() { + try { + restCatalog.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static Map getCatalogPropertiesFromConf( + Configuration conf, String catalogName) { + Map catalogProperties = Maps.newHashMap(); + String keyPrefix = CATALOG_CONFIG_PREFIX + catalogName; + conf.forEach(config -> { + if (config.getKey().startsWith(keyPrefix)) { + catalogProperties.put( + config.getKey().substring(keyPrefix.length() + 1), + config.getValue()); + } + }); + return catalogProperties; + } + + @Override + public List getDatabases(String databasePattern) throws MetaException, TException { + return getAllDatabases(); + } + + @Override + public List getDatabases(String catName, String databasePattern) throws MetaException, TException { + return getAllDatabases(); + } + + @Override + public List getAllDatabases() throws MetaException, TException { + return restCatalog.listNamespaces(Namespace.empty()).stream().map(Namespace::toString).collect(Collectors.toList()); + } + + @Override + public List getAllDatabases(String catName) throws MetaException, TException { + return getAllDatabases(); + } + + @Override + public List getTables(String dbName, String tablePattern) + throws MetaException, TException, UnknownDBException { + return getTables(null, dbName, tablePattern, null); + } + + @Override + public List getTables(String catName, String dbName, String tablePattern) + throws MetaException, TException, UnknownDBException { + return getTables(catName, dbName, tablePattern, null); + } + + @Override + public List getTables(String dbName, String tablePattern, TableType tableType) + throws MetaException, TException, UnknownDBException { + return getTables(null, dbName, tablePattern, tableType); + } + + @Override + public List getTables(String catName, String dbName, String tablePattern, TableType tableType) + throws MetaException, TException, UnknownDBException { + List tableIdentifiers = restCatalog.listTables(Namespace.of(dbName)); + return tableIdentifiers.stream().map(tableIdentifier -> tableIdentifier.name()).collect(Collectors.toList()); + } + + + @Override + public List getAllTables(String dbName) throws MetaException, TException, UnknownDBException { + return getTables(null, dbName, "", null); + } + + @Override + public List getAllTables(String catName, String dbName) throws MetaException, TException, UnknownDBException { + return getTables(catName, dbName, "", null); + } + + @Override + public void dropTable(String dbname, String tableName, boolean deleteData, boolean ignoreUnknownTab) + throws MetaException, TException, NoSuchObjectException { + dropTable(dbname, tableName); + } + + @Override + public void dropTable(String dbname, String tableName, boolean deleteData, boolean ignoreUnknownTab, boolean ifPurge) + throws MetaException, TException, NoSuchObjectException { + dropTable(dbname, tableName); + } + + @Override + public void dropTable(Table table, boolean deleteData, boolean ignoreUnknownTab, boolean ifPurge) throws TException { + dropTable(table.getDbName(), table.getTableName()); + } + + @Override + public void dropTable(String dbname, String tableName) throws MetaException, TException, NoSuchObjectException { + restCatalog.dropTable(TableIdentifier.of(dbname, tableName)); + } + + @Override + public void dropTable(String catName, String dbName, String tableName, boolean deleteData, boolean ignoreUnknownTable, + boolean ifPurge) throws MetaException, NoSuchObjectException, TException { + dropTable(dbName, tableName); + } + + @Override + public boolean tableExists(String databaseName, String tableName) + throws MetaException, TException, UnknownDBException { + try { + getTables(databaseName, tableName); + } catch (NoSuchTableException e) { + return false; + } + return true; + } + + @Override + public boolean tableExists(String catName, String dbName, String tableName) + throws MetaException, TException, UnknownDBException { + return tableExists(dbName, tableName); + } + + @Override + public Database getDatabase(String databaseName) throws NoSuchObjectException, MetaException, TException { + return restCatalog.listNamespaces(Namespace.empty()).stream() + .filter(namespace -> namespace.levels()[0].equals(databaseName)).map(namespace -> { + Database database = new Database(); + database.setName(String.join(NAMESPACE_SEPARATOR, namespace.levels())); + Map namespaceMetadata = restCatalog.loadNamespaceMetadata(Namespace.of(databaseName)); + database.setLocationUri(namespaceMetadata.get(LOCATION)); + database.setCatalogName("REST"); + database.setOwnerName(namespaceMetadata.get(DB_OWNER)); + try { + database.setOwnerType(PrincipalType.valueOf(namespaceMetadata.get(DB_OWNER_TYPE))); + } catch (Exception e) { + LOG.warn("Can not set ownerType: {}", namespaceMetadata.get(DB_OWNER_TYPE), e); + } + return database; + }).findFirst().get(); + } + + @Override + public Database getDatabase(String catalogName, String databaseName) + throws NoSuchObjectException, MetaException, TException { + return getDatabase(databaseName); + } + + @Override + public Table getTable(String dbName, String tableName) throws MetaException, TException, NoSuchObjectException { + org.apache.iceberg.Table icebergTable = null; + try { + icebergTable = restCatalog.loadTable(TableIdentifier.of(dbName, tableName)); + } catch (NoSuchTableException exception) { + throw new NoSuchObjectException(); + } + Table hiveTable = convertIcebergTableToHiveTable(icebergTable); + return hiveTable; + } + + private Table convertIcebergTableToHiveTable(org.apache.iceberg.Table icebergTable) { + Table hiveTable = new Table(); + TableMetadata metadata = ((BaseTable) icebergTable).operations().current(); + HMSTablePropertyHelper.updateHmsTableForIcebergTable(metadata.metadataFileLocation(), hiveTable, + metadata, null, true, maxHiveTablePropertySize, null); + hiveTable.getParameters().put(CATALOG_NAME, CatalogUtil.ICEBERG_CATALOG_TYPE_REST); + hiveTable.setTableName(getTableName(icebergTable)); + hiveTable.setDbName(getDbName(icebergTable)); + StorageDescriptor storageDescriptor = new StorageDescriptor(); + hiveTable.setSd(storageDescriptor); + hiveTable.setTableType("EXTERNAL_TABLE"); + hiveTable.setPartitionKeys(new LinkedList<>()); + List cols = new LinkedList<>(); + storageDescriptor.setCols(cols); + storageDescriptor.setLocation(icebergTable.location()); + storageDescriptor.setInputFormat(DEFAULT_INPUT_FORMAT_CLASS); + storageDescriptor.setOutputFormat(DEFAULT_OUTPUT_FORMAT_CLASS); + storageDescriptor.setBucketCols(new LinkedList<>()); + storageDescriptor.setSortCols(new LinkedList<>()); + storageDescriptor.setParameters(Maps.newHashMap()); + SerDeInfo serDeInfo = new SerDeInfo("icebergSerde", DEFAULT_SERDE_CLASS, Maps.newHashMap()); + serDeInfo.getParameters().put(serdeConstants.SERIALIZATION_FORMAT, "1"); // Default serialization format. + storageDescriptor.setSerdeInfo(serDeInfo); + icebergTable.schema().columns().forEach(icebergColumn -> { + FieldSchema fieldSchema = new FieldSchema(); + fieldSchema.setName(icebergColumn.name()); + fieldSchema.setType(icebergColumn.type().toString()); + cols.add(fieldSchema); + }); + return hiveTable; + } + private String getTableName(org.apache.iceberg.Table icebergTable) { + String[] nameParts = icebergTable.name().split("\\."); + if (nameParts.length == 3) { + return nameParts[2]; + } + if (nameParts.length == 2) { + return nameParts[1]; + } + return icebergTable.name(); + } + + private String getDbName(org.apache.iceberg.Table icebergTable) { + String[] nameParts = icebergTable.name().split("\\."); + return nameParts.length == 3 ? nameParts[1] : nameParts[0]; + } + + @Override + public Table getTable(String dbName, String tableName, boolean getColumnStats, String engine) + throws MetaException, TException, NoSuchObjectException { + return getTable(dbName, tableName); + } + + @Override + public Table getTable(String catName, String dbName, String tableName) throws MetaException, TException { + return getTable(dbName, tableName); + } + + @Override + public Table getTable(String catName, String dbName, String tableName, String validWriteIdList) throws TException { + return getTable(dbName, tableName); + } + + @Override + public Table getTable(String catName, String dbName, String tableName, String validWriteIdList, + boolean getColumnStats, String engine) throws TException { + return getTable(dbName, tableName); + } + + @Override + public Table getTable(GetTableRequest getTableRequest) throws MetaException, TException, NoSuchObjectException { + return getTable(getTableRequest.getDbName(), getTableRequest.getTblName()); + } + + public void createTable(Table tbl) + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { + List cols = Lists.newArrayList(tbl.getSd().getCols()); + if (tbl.isSetPartitionKeys() && !tbl.getPartitionKeys().isEmpty()) { + cols.addAll(tbl.getPartitionKeys()); + } + Properties catalogProperties = HMSTablePropertyHelper.getCatalogProperties(tbl); + Schema schema = HiveSchemaUtil.convert(cols, true); + SortOrder sortOrder = HMSTablePropertyHelper.getSortOrder(catalogProperties, schema); + org.apache.iceberg.PartitionSpec partitionSpec = HMSTablePropertyHelper.createPartitionSpec(this.conf, schema); + org.apache.iceberg.Table table = restCatalog + .buildTable(TableIdentifier.of(tbl.getDbName(), tbl.getTableName()), schema) + .withPartitionSpec(partitionSpec) + .withLocation(catalogProperties.getProperty(LOCATION)) + .withSortOrder(sortOrder) + .withProperties( + catalogProperties + .entrySet() + .stream() + .collect(Collectors.toMap(entry -> ((Map.Entry) entry).getKey().toString(), + entry -> ((Map.Entry) entry).getValue().toString()) + )) + .create(); + } + + private HiveMetaHook getHook(Table tbl) throws MetaException { + if (hookLoader == null) { + return null; + } + return hookLoader.getHook(tbl); + } + @Override + public void createTable(CreateTableRequest request) + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { + createTable(request.getTable()); + } + + @Override + public void createDatabase(Database db) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + Map props = Maps.newHashMap(); + props.put(LOCATION, db.getLocationUri()); + props.put(DB_OWNER, db.getOwnerName()); + props.put(DB_OWNER_TYPE, db.getOwnerType().toString()); + restCatalog.createNamespace(Namespace.of(db.getName()), props); + } + + @Override + public void dropDatabase(String name) + throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + restCatalog.dropNamespace(Namespace.of(name)); + } + + @Override + public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb) + throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + dropDatabase(name); + } + + @Override + public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade) + throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + dropDatabase(name); + } + + @Override + public void dropDatabase(DropDatabaseRequest req) throws TException { + dropDatabase(req.getName()); + } + + @Override + public ShowLocksResponse showLocks() throws TException { + return null; + } + + @Override + public void createTableWithConstraints(Table tTbl, List primaryKeys, List foreignKeys, + List uniqueConstraints, List notNullConstraints, + List defaultConstraints, List checkConstraints) + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { + createTable(tTbl); + } + + @Override + public WMFullResourcePlan getResourcePlan(String resourcePlanName, String ns) + throws NoSuchObjectException, MetaException, TException { + return null; + } + + @Override + public boolean updateCompactionMetricsData(CompactionMetricsDataStruct struct) throws MetaException, TException { + return false; + } + + public Configuration getConf() { + return conf; + } +} diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java new file mode 100644 index 000000000000..1ff842ea0424 --- /dev/null +++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java @@ -0,0 +1,187 @@ +/* + * 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.iceberg.hive; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.Map; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.metastore.api.Database; +import org.apache.hadoop.hive.metastore.api.FieldSchema; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.api.StorageDescriptor; +import org.apache.hadoop.hive.metastore.api.Table; +import org.apache.iceberg.BaseTable; +import org.apache.iceberg.CatalogUtil; +import org.apache.iceberg.PartitionSpec; +import org.apache.iceberg.Schema; +import org.apache.iceberg.SortOrder; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.TableOperations; +import org.apache.iceberg.Transaction; +import org.apache.iceberg.catalog.Catalog; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.catalog.TableIdentifier; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.io.LocationProvider; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.rest.RESTCatalog; +import org.apache.thrift.TException; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; + +public class TestHiveIcebergRESTCatalogClientAdapter { + + static HiveIcebergRESTCatalogClientAdapter hiveIcebergRESTCatalogClientAdapter; + static RESTCatalog restCatalog; + private static MockedStatic catalogUtilMockedStatic; + + @BeforeAll + public static void before() throws MetaException { + Configuration configuration = new Configuration(); + configuration.set("iceberg.catalog", "rest"); + configuration.set("iceberg.catalog.rest.type", "rest"); + configuration.set("iceberg.catalog.rest.uri", "http://localhost"); + catalogUtilMockedStatic = Mockito.mockStatic(CatalogUtil.class); + restCatalog = Mockito.mock(RESTCatalog.class); + catalogUtilMockedStatic.when(() -> CatalogUtil.buildIcebergCatalog(any(), any(), any())).thenReturn(restCatalog); + hiveIcebergRESTCatalogClientAdapter = Mockito.spy(new HiveIcebergRESTCatalogClientAdapter(configuration, null)); + hiveIcebergRESTCatalogClientAdapter.reconnect(); + TableOperations ops = new TableOperations() { + @Override + public TableMetadata current() { + return TableMetadata.newTableMetadata(new Schema(), PartitionSpec.unpartitioned(), "location", + Maps.newHashMap()); + } + + @Override + public TableMetadata refresh() { + return null; + } + + @Override + public void commit(TableMetadata base, TableMetadata metadata) { + + } + + @Override + public FileIO io() { + return null; + } + + @Override + public String metadataFileLocation(String fileName) { + return null; + } + + @Override + public LocationProvider locationProvider() { + return null; + } + }; + Mockito.doReturn(new BaseTable(ops, "tableName")).when(restCatalog).loadTable(any()); + Namespace namespace = Namespace.of("default"); + Mockito.doReturn(Arrays.asList(namespace)).when(restCatalog).listNamespaces(any()); + Mockito.doReturn(new BaseTable(ops, "tableName")).when(restCatalog).createTable(any(), any(), any(), any()); + Mockito.doReturn(tableBuilder).when(restCatalog).buildTable(any(), any()); + } + static Catalog.TableBuilder tableBuilder = new Catalog.TableBuilder() { + @Override + public Catalog.TableBuilder withPartitionSpec(PartitionSpec spec) { + return this; + } + + @Override + public Catalog.TableBuilder withSortOrder(SortOrder sortOrder) { + return this; + } + + @Override + public Catalog.TableBuilder withLocation(String location) { + return this; + } + + @Override + public Catalog.TableBuilder withProperties(Map properties) { + return this; + } + + @Override + public Catalog.TableBuilder withProperty(String key, String value) { + return this; + } + + @Override + public org.apache.iceberg.Table create() { + return null; + } + + @Override + public Transaction createTransaction() { + return null; + } + + @Override + public Transaction replaceTransaction() { + return null; + } + + @Override + public Transaction createOrReplaceTransaction() { + return null; + } + }; + + @AfterEach + public void after() { + + } + + @Test + public void testGetTable() throws TException { + hiveIcebergRESTCatalogClientAdapter.getTable("default", "tableName"); + Mockito.verify(restCatalog).loadTable(TableIdentifier.of("default", "tableName")); + } + + @Test + public void testCreateTable() throws TException { + Table table = new Table(); + table.setTableName("tableName"); + table.setDbName("default"); + table.setSd(new StorageDescriptor()); + table.getSd().setCols(new LinkedList()); + table.setParameters(Maps.newHashMap()); + hiveIcebergRESTCatalogClientAdapter.createTable(table); + Mockito.verify(restCatalog).buildTable(any(), any()); + } + + @Test + public void testGetDatabase() throws TException { + Database aDefault = hiveIcebergRESTCatalogClientAdapter.getDatabase("default"); + assertThat(aDefault.getName()).isEqualTo("default"); + Mockito.verify(restCatalog).listNamespaces(Namespace.empty()); + } +} diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java index 5a219b58a082..b797d7aa9763 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java @@ -31,16 +31,14 @@ import org.apache.iceberg.Schema; import org.apache.iceberg.SchemaParser; import org.apache.iceberg.SortOrder; -import org.apache.iceberg.SortOrderParser; import org.apache.iceberg.Table; -import org.apache.iceberg.TableProperties; import org.apache.iceberg.catalog.Catalog; import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.hadoop.HadoopTables; +import org.apache.iceberg.hive.HMSTablePropertyHelper; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet; import org.apache.iceberg.relocated.com.google.common.collect.Maps; -import org.apache.parquet.Strings; /** * Class for catalog resolution and accessing the common functions for {@link Catalog} API. @@ -144,7 +142,7 @@ public static Table createTable(Configuration conf, Properties props) { Map map = filterIcebergTableProperties(props); Optional catalog = loadCatalog(conf, catalogName); - SortOrder sortOrder = getSortOrder(props, schema); + SortOrder sortOrder = HMSTablePropertyHelper.getSortOrder(props, schema); if (catalog.isPresent()) { String name = props.getProperty(NAME); Preconditions.checkNotNull(name, "Table identifier not set"); @@ -156,12 +154,6 @@ public static Table createTable(Configuration conf, Properties props) { return new HadoopTables(conf).create(schema, spec, sortOrder, map, location); } - private static SortOrder getSortOrder(Properties props, Schema schema) { - String sortOrderJsonString = props.getProperty(TableProperties.DEFAULT_SORT_ORDER); - return Strings.isNullOrEmpty(sortOrderJsonString) ? - SortOrder.unsorted() : SortOrderParser.fromJson(schema, sortOrderJsonString); - } - /** * Drops an Iceberg table using the catalog specified by the configuration. *

@@ -227,7 +219,7 @@ public static Table registerTable(Configuration conf, Properties props, String m return catalog.get().registerTable(TableIdentifier.parse(name), metadataLocation); } Preconditions.checkNotNull(location, "Table location not set"); - SortOrder sortOrder = getSortOrder(props, schema); + SortOrder sortOrder = HMSTablePropertyHelper.getSortOrder(props, schema); return new HadoopTables(conf).create(schema, spec, sortOrder, map, location); } diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java index fb53247536dc..cf05e7f137e1 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java @@ -921,7 +921,7 @@ private static PartitionSpec spec(Configuration configuration, Schema schema, "We can only handle non-partitioned Hive tables. The Iceberg schema should be in " + InputFormatConfig.PARTITION_SPEC + " or already converted to a partition transform "); - PartitionSpec spec = IcebergTableUtil.spec(configuration, schema); + PartitionSpec spec = HMSTablePropertyHelper.createPartitionSpec(configuration, schema); if (spec != null) { Preconditions.checkArgument(hmsTable.getParameters().get(InputFormatConfig.PARTITION_SPEC) == null, "Provide only one of the following: Hive partition transform specification, or the " + diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java index b4d9f0bea227..38cef81076db 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java @@ -173,6 +173,7 @@ import org.apache.iceberg.expressions.StrictMetricsEvaluator; import org.apache.iceberg.hadoop.ConfigProperties; import org.apache.iceberg.hadoop.HadoopConfigurable; +import org.apache.iceberg.hive.HMSTablePropertyHelper; import org.apache.iceberg.hive.HiveSchemaUtil; import org.apache.iceberg.hive.HiveTableOperations; import org.apache.iceberg.io.CloseableIterable; @@ -1662,7 +1663,7 @@ static void overlayTableProperties(Configuration configuration, TableDesc tableD AbstractSerDe serDe = tableDesc.getDeserializer(configuration); HiveIcebergSerDe icebergSerDe = (HiveIcebergSerDe) serDe; schema = icebergSerDe.getTableSchema(); - spec = IcebergTableUtil.spec(configuration, icebergSerDe.getTableSchema()); + spec = HMSTablePropertyHelper.createPartitionSpec(configuration, icebergSerDe.getTableSchema()); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java index 2e4e5f0a094e..570e2408de85 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java @@ -80,6 +80,7 @@ import org.apache.iceberg.expressions.Expression; import org.apache.iceberg.expressions.Expressions; import org.apache.iceberg.expressions.ResidualEvaluator; +import org.apache.iceberg.hive.HMSTablePropertyHelper; import org.apache.iceberg.hive.HiveSchemaUtil; import org.apache.iceberg.io.CloseableIterable; import org.apache.iceberg.mr.Catalogs; @@ -229,54 +230,9 @@ static PartitionStatisticsFile getPartitionStatsFile(Table table, long snapshotI .findAny().orElse(null); } - /** - * Create {@link PartitionSpec} based on the partition information stored in - * {@link TransformSpec}. - * @param configuration a Hadoop configuration - * @param schema iceberg table schema - * @return iceberg partition spec, always non-null - */ - public static PartitionSpec spec(Configuration configuration, Schema schema) { - List partitionTransformSpecList = SessionStateUtil - .getResource(configuration, hive_metastoreConstants.PARTITION_TRANSFORM_SPEC) - .map(o -> (List) o).orElse(null); - - if (partitionTransformSpecList == null) { - LOG.warn("Iceberg partition transform spec is not found in QueryState."); - return null; - } - PartitionSpec.Builder builder = PartitionSpec.builderFor(schema); - partitionTransformSpecList.forEach(spec -> { - switch (spec.getTransformType()) { - case IDENTITY: - builder.identity(spec.getColumnName().toLowerCase()); - break; - case YEAR: - builder.year(spec.getColumnName()); - break; - case MONTH: - builder.month(spec.getColumnName()); - break; - case DAY: - builder.day(spec.getColumnName()); - break; - case HOUR: - builder.hour(spec.getColumnName()); - break; - case TRUNCATE: - builder.truncate(spec.getColumnName(), spec.getTransformParam().get()); - break; - case BUCKET: - builder.bucket(spec.getColumnName(), spec.getTransformParam().get()); - break; - } - }); - return builder.build(); - } - public static void updateSpec(Configuration configuration, Table table) { // get the new partition transform spec - PartitionSpec newPartitionSpec = spec(configuration, table.schema()); + PartitionSpec newPartitionSpec = HMSTablePropertyHelper.createPartitionSpec(configuration, table.schema()); if (newPartitionSpec == null) { LOG.warn("Iceberg partition spec is not updated due to empty partition spec definition."); return; diff --git a/iceberg/pom.xml b/iceberg/pom.xml index b08885f5dc81..6780d80818e7 100644 --- a/iceberg/pom.xml +++ b/iceberg/pom.xml @@ -221,6 +221,21 @@ value ${immutables.value.version} + + org.apache.httpcomponents.client5 + httpclient5 + ${httpcomponents5.client.version} + + + org.apache.httpcomponents.core5 + httpcore5 + ${httpcomponents5.core.version} + + + org.apache.httpcomponents.core5 + httpcore5-h2 + ${httpcomponents5.core.version} + diff --git a/pom.xml b/pom.xml index 5fbc655ef816..19d90c614872 100644 --- a/pom.xml +++ b/pom.xml @@ -151,6 +151,8 @@ 4.5.13 4.4.13 2.9.2 + 5.3 + 5.3 2.5.2 2.16.1 2.3.4 @@ -608,6 +610,21 @@ httpcore ${httpcomponents.core.version} + + org.apache.httpcomponents.client5 + httpclient5 + ${httpcomponents5.core.version} + + + org.apache.httpcomponents.core5 + httpcore5 + ${httpcomponents5.core.version} + + + org.apache.httpcomponents.core5 + httpcore5-h2 + ${httpcomponents5.core.version} + org.apache.velocity velocity-engine-core diff --git a/ql/pom.xml b/ql/pom.xml index 06c765bb9863..07135c0bbd15 100644 --- a/ql/pom.xml +++ b/ql/pom.xml @@ -884,6 +884,18 @@ RoaringBitmap ${roaringbit.version} + + org.apache.httpcomponents.client5 + httpclient5 + + + org.apache.httpcomponents.core5 + httpcore5 + + + org.apache.httpcomponents.core5 + httpcore5-h2 + diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java index 60db27498627..cc9e85f1d2e3 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java @@ -49,6 +49,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; +import java.lang.reflect.Proxy; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; @@ -128,6 +129,7 @@ import org.apache.hadoop.hive.metastore.client.SynchronizedMetaStoreClient; import org.apache.hadoop.hive.metastore.client.ThriftHiveMetaStoreClient; import org.apache.hadoop.hive.metastore.conf.MetastoreConf; +import org.apache.hadoop.hive.metastore.utils.JavaUtils; import org.apache.hadoop.hive.metastore.utils.RetryUtilities; import org.apache.hadoop.hive.ql.Context; import org.apache.hadoop.hive.ql.ddl.table.AlterTableType; @@ -253,6 +255,7 @@ import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.mapred.InputFormat; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.StringUtils; import org.apache.hive.common.util.HiveVersionInfo; import org.apache.thrift.TException; @@ -6004,23 +6007,7 @@ public HiveMetaHook getHook( return storageHandler == null ? null : storageHandler.getMetaHook(); } }; - - IMetaStoreClient thriftClient = ThriftHiveMetaStoreClient.newClient(conf, allowEmbedded); - IMetaStoreClient clientWithLocalCache = HiveMetaStoreClientWithLocalCache.newClient(conf, thriftClient); - IMetaStoreClient sessionLevelClient = SessionHiveMetaStoreClient.newClient(conf, clientWithLocalCache); - IMetaStoreClient clientWithHook = HookEnabledMetaStoreClient.newClient(conf, hookLoader, sessionLevelClient); - - if (conf.getBoolVar(ConfVars.METASTORE_FASTPATH)) { - return SynchronizedMetaStoreClient.newClient(conf, clientWithHook); - } else { - return RetryingMetaStoreClient.getProxy( - conf, - new Class[] {Configuration.class, IMetaStoreClient.class}, - new Object[] {conf, clientWithHook}, - metaCallTimeMap, - SynchronizedMetaStoreClient.class.getName() - ); - } + return IMetaStoreClientFactory.create(conf, allowEmbedded, metaCallTimeMap, hookLoader); } @Nullable diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java new file mode 100644 index 000000000000..054580681645 --- /dev/null +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java @@ -0,0 +1,78 @@ +/* + * 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.ql.metadata; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.HiveMetaHookLoader; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.client.HookEnabledMetaStoreClient; +import org.apache.hadoop.hive.metastore.client.SynchronizedMetaStoreClient; +import org.apache.hadoop.hive.metastore.client.ThriftHiveMetaStoreClient; +import org.apache.hadoop.hive.metastore.utils.JavaUtils; +import org.apache.hadoop.hive.ql.exec.Utilities; + +import java.util.concurrent.ConcurrentHashMap; + +public class IMetaStoreClientFactory { + + public static final String REST_METASTORE_TYPE = "rest"; + + public static IMetaStoreClient create(HiveConf hiveConf, boolean allowEmbedded, + ConcurrentHashMap metaCallTimeMap, HiveMetaHookLoader hookLoader) throws MetaException { + + if (REST_METASTORE_TYPE.equals(hiveConf.get("metastore.type", "hms"))) { + return getHiveIcebergRESTCatalog(hiveConf, hookLoader); + } + IMetaStoreClient thriftClient = ThriftHiveMetaStoreClient.newClient(hiveConf, allowEmbedded); + IMetaStoreClient clientWithLocalCache = HiveMetaStoreClientWithLocalCache.newClient(hiveConf, thriftClient); + IMetaStoreClient sessionLevelClient = SessionHiveMetaStoreClient.newClient(hiveConf, clientWithLocalCache); + IMetaStoreClient clientWithHook = HookEnabledMetaStoreClient.newClient(hiveConf, hookLoader, sessionLevelClient); + + if (hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_FASTPATH)) { + return SynchronizedMetaStoreClient.newClient(hiveConf, clientWithHook); + } else { + return RetryingMetaStoreClient.getProxy( + hiveConf, + new Class[] {Configuration.class, IMetaStoreClient.class}, + new Object[] {hiveConf, clientWithHook}, + metaCallTimeMap, + SynchronizedMetaStoreClient.class.getName() + ); + } + } + private static IMetaStoreClient getHiveIcebergRESTCatalog(HiveConf conf, HiveMetaHookLoader hookLoader) throws + MetaException { + try { + Class handlerClass = + (Class) + Class.forName("org.apache.iceberg.hive.HiveIcebergRESTCatalogClientAdapter", true, Utilities.getSessionSpecifiedClassLoader()); + Class[] constructorArgTypes = new Class[] { Configuration.class, HiveMetaHookLoader.class}; + Object[] constructorArgs = new Object[] {conf, hookLoader}; + IMetaStoreClient restCatalogMetastoreClient = JavaUtils.newInstance(handlerClass, constructorArgTypes, constructorArgs); + restCatalogMetastoreClient.reconnect(); + return restCatalogMetastoreClient; + } catch (ClassNotFoundException e) { + throw new MetaException("Error in loading HiveIcebergRESTCatalogClientAdapter class." + + e.getMessage()); + } + } +} diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 7b7d6823d559..bfe581491c7f 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -21,6 +21,8 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -30,6 +32,8 @@ import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.common.TableName; +import org.apache.hadoop.hive.common.ValidCleanerWriteIdList; +import org.apache.hadoop.hive.common.ValidReadTxnList; import org.apache.hadoop.hive.common.ValidTxnList; import org.apache.hadoop.hive.common.ValidWriteIdList; import org.apache.hadoop.hive.common.classification.RetrySemantics; @@ -50,20 +54,24 @@ public interface IMetaStoreClient extends AutoCloseable { * Returns whether current client is compatible with conf argument or not * @return */ - boolean isCompatibleWith(Configuration conf); + default boolean isCompatibleWith(Configuration configuration) { + return false; + } /** * 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); + default void setHiveAddedJars(String addedJars){}; /** * Returns true if the current client is using an in process metastore (local metastore). * * @return */ - boolean isLocalMetaStore(); + default boolean isLocalMetaStore(){ + return false; + } /** * Tries to reconnect this MetaStoreClient to the MetaStore. @@ -79,12 +87,14 @@ public interface IMetaStoreClient extends AutoCloseable { /** * set meta variable which is open to end users */ - void setMetaConf(String key, String value) throws MetaException, TException; + default void setMetaConf(String key, String value) throws MetaException, TException {} /** * get current meta variable */ - String getMetaConf(String key) throws MetaException, TException; + default String getMetaConf(String key) throws MetaException, TException{ + return ""; + } /** * Create a new catalog. @@ -95,8 +105,9 @@ public interface IMetaStoreClient extends AutoCloseable { * create the directory for the catalog. * @throws TException general thrift exception. */ - void createCatalog(Catalog catalog) - throws AlreadyExistsException, InvalidObjectException, MetaException, TException; + default void createCatalog(Catalog catalog) + throws AlreadyExistsException, InvalidObjectException, MetaException, TException{ + } /** * Alter an existing catalog. @@ -110,8 +121,9 @@ void createCatalog(Catalog catalog) * @throws MetaException usually indicates a database error * @throws TException general thrift exception */ - void alterCatalog(String catalogName, Catalog newCatalog) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default void alterCatalog(String catalogName, Catalog newCatalog) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException{ + } /** * Get a catalog object. @@ -121,7 +133,9 @@ void alterCatalog(String catalogName, Catalog newCatalog) * @throws MetaException something went wrong, usually in the database. * @throws TException general thrift exception. */ - Catalog getCatalog(String catName) throws NoSuchObjectException, MetaException, TException; + default Catalog getCatalog(String catName) throws NoSuchObjectException, MetaException, TException{ + return null; + } /** * Get a list of all catalogs known to the system. @@ -129,7 +143,9 @@ void alterCatalog(String catalogName, Catalog newCatalog) * @throws MetaException something went wrong, usually in the database. * @throws TException general thrift exception. */ - List getCatalogs() throws MetaException, TException; + default List getCatalogs() throws MetaException, TException{ + return new LinkedList<>(); + } /** * Drop a catalog. Catalogs must be empty to be dropped, there is no cascade for dropping a @@ -140,8 +156,9 @@ void alterCatalog(String catalogName, Catalog newCatalog) * @throws MetaException something went wrong, usually in the database. * @throws TException general thrift exception. */ - void dropCatalog(String catName) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; + default void dropCatalog(String catName) + throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + } /** * Drop a catalog. Catalogs must be empty to be dropped, there is no cascade for dropping a @@ -150,7 +167,8 @@ void dropCatalog(String catName) * @param ifExists if true, do not throw an error if the catalog does not exist. * @throws TException general thrift exception. */ - void dropCatalog(String catName, boolean ifExists) throws TException; + default void dropCatalog(String catName, boolean ifExists) throws TException { + } /** * Get the names of all databases in the default catalog that match the given pattern. @@ -253,8 +271,10 @@ List getTables(String catName, String dbName, String tablePattern, Table * @throws TException thrift transport error * @throws UnknownDBException no such database */ - List getAllMaterializedViewObjectsForRewriting() - throws MetaException, TException, UnknownDBException; + default List
getAllMaterializedViewObjectsForRewriting() + throws MetaException, TException, UnknownDBException{ + return Collections.emptyList(); + } /** * Get the names of all the tables along with extended table metadata @@ -267,8 +287,10 @@ List
getAllMaterializedViewObjectsForRewriting() * @throws MetaException Thrown if there is error on fetching from DBMS. * @throws TException Thrown if there is a thrift transport exception. */ - public List getTablesExt(String catName, String dbName, String tablePattern, int requestedFields, - int limit) throws MetaException, TException; + default List getTablesExt(String catName, String dbName, String tablePattern, int requestedFields, + int limit) throws MetaException, TException{ + return Collections.emptyList(); + } /** * Get materialized views that have rewriting enabled. This will use the default catalog. @@ -278,8 +300,10 @@ public List getTablesExt(String catName, String dbName, Strin * @throws TException thrift transport error * @throws UnknownDBException no such database */ - List getMaterializedViewsForRewriting(String dbName) - throws MetaException, TException, UnknownDBException; + default List getMaterializedViewsForRewriting(String dbName) + throws MetaException, TException, UnknownDBException{ + return Collections.emptyList(); + } /** * Get materialized views that have rewriting enabled. @@ -290,8 +314,10 @@ List getMaterializedViewsForRewriting(String dbName) * @throws TException thrift transport error * @throws UnknownDBException no such database */ - List getMaterializedViewsForRewriting(String catName, String dbName) - throws MetaException, TException, UnknownDBException; + default List getMaterializedViewsForRewriting(String catName, String dbName) + throws MetaException, TException, UnknownDBException{ + return Collections.emptyList(); + } /** * Fetches just table name and comments. Useful when you need full table name @@ -305,8 +331,10 @@ List getMaterializedViewsForRewriting(String catName, String dbName) * @throws TException thrift transport error * @throws UnknownDBException No databases match the provided pattern. */ - List getTableMeta(String dbPatterns, String tablePatterns, List tableTypes) - throws MetaException, TException, UnknownDBException; + default List getTableMeta(String dbPatterns, String tablePatterns, List tableTypes) + throws MetaException, TException, UnknownDBException{ + return Collections.emptyList(); + } /** * Fetches just table name and comments. Useful when you need full table name @@ -321,9 +349,11 @@ List getTableMeta(String dbPatterns, String tablePatterns, List getTableMeta(String catName, String dbPatterns, String tablePatterns, + default List getTableMeta(String catName, String dbPatterns, String tablePatterns, List tableTypes) - throws MetaException, TException, UnknownDBException; + throws MetaException, TException, UnknownDBException{ + return Collections.emptyList(); + } /** * Get the names of all tables in the specified database. @@ -386,8 +416,10 @@ List getAllTables(String catName, String dbName) * @throws UnknownDBException no such database * @throws TException thrift transport error */ - List listTableNamesByFilter(String dbName, String filter, short maxTables) - throws TException, InvalidOperationException, UnknownDBException; + default List listTableNamesByFilter(String dbName, String filter, short maxTables) + throws TException, InvalidOperationException, UnknownDBException{ + return Collections.emptyList(); + } /** * Get a list of table names that match a filter. @@ -429,8 +461,10 @@ List listTableNamesByFilter(String dbName, String filter, short maxTable * @throws UnknownDBException no such database * @throws TException thrift transport error */ - List listTableNamesByFilter(String catName, String dbName, String filter, int maxTables) - throws TException, InvalidOperationException, UnknownDBException; + default List listTableNamesByFilter(String catName, String dbName, String filter, int maxTables) + throws TException, InvalidOperationException, UnknownDBException{ + return Collections.emptyList(); + } /** * Drop the table. @@ -566,18 +600,19 @@ default void dropTable(String catName, String dbName, String tableName) * @throws TException Thrift transport exception */ @Deprecated - void truncateTable(String dbName, String tableName, List partNames) throws MetaException, TException; + default void truncateTable(String dbName, String tableName, List partNames) throws MetaException, TException{} + + default void truncateTable(TableName table, List partNames) throws TException{} - void truncateTable(TableName table, List partNames) throws TException; + default void truncateTable(String dbName, String tableName, List partNames, + String validWriteIds, long writeId) throws TException{} - void truncateTable(String dbName, String tableName, List partNames, - String validWriteIds, long writeId) throws TException; - void truncateTable(String dbName, String tableName, List partNames, - String validWriteIds, long writeId, boolean deleteData) throws TException; + default void truncateTable(String dbName, String tableName, List partNames, + String validWriteIds, long writeId, boolean deleteData) throws TException {}; - void truncateTable(String catName, String dbName, String tableName, String ref, List partNames, - String validWriteIds, long writeId, boolean deleteData, EnvironmentContext context) throws TException; + default void truncateTable(String catName, String dbName, String tableName, String ref, List partNames, + String validWriteIds, long writeId, boolean deleteData, EnvironmentContext context) throws TException {}; /** * Recycles the files recursively from the input path to the cmroot directory either by copying or moving it. @@ -586,7 +621,9 @@ void truncateTable(String catName, String dbName, String tableName, String ref, * 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; + default CmRecycleResponse recycleDirToCmPath(CmRecycleRequest request) throws MetaException, TException{ + return new CmRecycleResponse(); + } /** * Check whether a table exists in the default catalog. @@ -742,8 +779,10 @@ Table getTable(String catName, String dbName, String tableName, * @throws MetaException * Any other errors */ - List
getTableObjectsByName(String dbName, List tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException; + default List
getTableObjectsByName(String dbName, List tableNames) + throws MetaException, InvalidOperationException, UnknownDBException, TException{ + return Collections.emptyList(); + } /** * Get tables as objects (rather than just fetching their names). This is more expensive and @@ -765,8 +804,10 @@ List
getTableObjectsByName(String dbName, List tableNames) * @throws MetaException * Any other errors */ - List
getTables(String catName, String dbName, List tableNames, GetProjectionsSpec projectionsSpec) - throws MetaException, InvalidOperationException, UnknownDBException, TException; + default List
getTables(String catName, String dbName, List tableNames, GetProjectionsSpec projectionsSpec) + throws MetaException, InvalidOperationException, UnknownDBException, TException{ + return Collections.emptyList(); + } /** * 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. @@ -788,26 +829,30 @@ List
getTables(String catName, String dbName, List tableNames, Ge * @throws MetaException * Any other errors */ - List
getTableObjectsByName(String catName, String dbName, List tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException; + default List
getTableObjectsByName(String catName, String dbName, List tableNames) + throws MetaException, InvalidOperationException, UnknownDBException, TException{ + return Collections.emptyList(); + } /** * Returns the invalidation information for the materialized views given as input. */ - Materialization getMaterializationInvalidationInfo(CreationMetadata cm, String validTxnList) - throws MetaException, InvalidOperationException, UnknownDBException, TException; + default Materialization getMaterializationInvalidationInfo(CreationMetadata cm, String validTxnList) + throws MetaException, InvalidOperationException, UnknownDBException, TException{ + return new Materialization(); + } /** * Updates the creation metadata for the materialized view. */ - void updateCreationMetadata(String dbName, String tableName, CreationMetadata cm) - throws MetaException, TException; + default 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; + default void updateCreationMetadata(String catName, String dbName, String tableName, CreationMetadata cm) + throws MetaException, TException{} /** /** @@ -822,8 +867,10 @@ void updateCreationMetadata(String catName, String dbName, String tableName, Cre * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Partition appendPartition(String dbName, String tableName, List partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default Partition appendPartition(String dbName, String tableName, List partVals) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return new Partition(); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -838,8 +885,10 @@ Partition appendPartition(String dbName, String tableName, List partVals * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Partition appendPartition(String catName, String dbName, String tableName, List partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default Partition appendPartition(String catName, String dbName, String tableName, List partVals) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return new Partition(); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -853,8 +902,10 @@ Partition appendPartition(String catName, String dbName, String tableName, List< * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Partition appendPartition(String dbName, String tableName, String name) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default Partition appendPartition(String dbName, String tableName, String name) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return new Partition(); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -869,8 +920,10 @@ Partition appendPartition(String dbName, String tableName, String name) * @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; + default Partition appendPartition(String catName, String dbName, String tableName, String name) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return new Partition(); + } /** * Add a partition to the table. @@ -887,8 +940,10 @@ Partition appendPartition(String catName, String dbName, String tableName, Strin * @throws TException * Thrift exception */ - Partition add_partition(Partition partition) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default Partition add_partition(Partition partition) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return new Partition(); + } /** * Add partitions to the table. @@ -904,8 +959,10 @@ Partition add_partition(Partition partition) * @throws TException * Thrift exception */ - int add_partitions(List partitions) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default int add_partitions(List partitions) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return 0; + } /** * Add a partitions using a spec proxy. @@ -916,8 +973,10 @@ int add_partitions(List partitions) * @throws MetaException error accessing the RDBMS or storage. * @throws TException thrift transport error */ - int add_partitions_pspec(PartitionSpecProxy partitionSpec) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default int add_partitions_pspec(PartitionSpecProxy partitionSpec) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return 0; + } /** * Add partitions to the table. @@ -927,9 +986,11 @@ int add_partitions_pspec(PartitionSpecProxy partitionSpec) * @param needResults Whether the results are needed * @return the partitions that were added, or null if !needResults */ - List add_partitions( + default List add_partitions( List partitions, boolean ifNotExists, boolean needResults) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ + return Collections.emptyList(); + } /** * Get a partition. @@ -942,8 +1003,10 @@ List add_partitions( * @throws MetaException error access the RDBMS. * @throws TException thrift transport error */ - Partition getPartition(String dbName, String tblName, List partVals) - throws NoSuchObjectException, MetaException, TException; + default Partition getPartition(String dbName, String tblName, List partVals) + throws NoSuchObjectException, MetaException, TException{ + return new Partition(); + } /** * Get a partition. @@ -953,8 +1016,10 @@ Partition getPartition(String dbName, String tblName, List partVals) * @throws MetaException error access the RDBMS. * @throws TException thrift transport error */ - GetPartitionResponse getPartitionRequest(GetPartitionRequest req) - throws NoSuchObjectException, MetaException, TException; + default GetPartitionResponse getPartitionRequest(GetPartitionRequest req) + throws NoSuchObjectException, MetaException, TException{ + return new GetPartitionResponse(); + } /** * Get a partition. @@ -968,8 +1033,10 @@ GetPartitionResponse getPartitionRequest(GetPartitionRequest req) * @throws MetaException error access the RDBMS. * @throws TException thrift transport error */ - Partition getPartition(String catName, String dbName, String tblName, List partVals) - throws NoSuchObjectException, MetaException, TException; + default Partition getPartition(String catName, String dbName, String tblName, List partVals) + throws NoSuchObjectException, MetaException, TException{ + return new Partition(); + } /** * Move a partition from one table to another @@ -984,10 +1051,12 @@ Partition getPartition(String catName, String dbName, String tblName, List partitionSpecs, + default Partition exchange_partition(Map partitionSpecs, String sourceDb, String sourceTable, String destdb, String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; + InvalidObjectException, TException{ + return new Partition(); + } /** * Move a partition from one table to another @@ -1004,10 +1073,12 @@ Partition exchange_partition(Map partitionSpecs, * @throws InvalidObjectException error in partition specifications * @throws TException thrift transport error */ - Partition exchange_partition(Map partitionSpecs, String sourceCat, + default Partition exchange_partition(Map partitionSpecs, String sourceCat, String sourceDb, String sourceTable, String destCat, String destdb, String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; + InvalidObjectException, TException{ + return new Partition(); + } /** * With the one partitionSpecs to exchange, multiple partitions could be exchanged. @@ -1024,10 +1095,12 @@ Partition exchange_partition(Map partitionSpecs, String sourceCa * @throws TException thrift transport error * @return the list of the new partitions */ - List exchange_partitions(Map partitionSpecs, + default List exchange_partitions(Map partitionSpecs, String sourceDb, String sourceTable, String destdb, String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException; + InvalidObjectException, TException { + return Collections.emptyList(); + } /** * With the one partitionSpecs to exchange, multiple partitions could be exchanged. @@ -1046,10 +1119,12 @@ List exchange_partitions(Map partitionSpecs, * @throws TException thrift transport error * @return the list of the new partitions */ - List exchange_partitions(Map partitionSpecs, String sourceCat, + default List exchange_partitions(Map partitionSpecs, String sourceCat, String sourceDb, String sourceTable, String destCat, String destdb, String destTableName) - throws MetaException, NoSuchObjectException, InvalidObjectException, TException; + throws MetaException, NoSuchObjectException, InvalidObjectException, TException { + return Collections.emptyList(); + } /** * Get a Partition by name. @@ -1060,8 +1135,10 @@ List exchange_partitions(Map partitionSpecs, String s * @throws MetaException error access the RDBMS. * @throws TException thrift transport error */ - Partition getPartition(String dbName, String tblName, String name) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; + default Partition getPartition(String dbName, String tblName, String name) + throws MetaException, UnknownTableException, NoSuchObjectException, TException{ + return new Partition(); + } /** * Get a Partition by name. @@ -1073,8 +1150,10 @@ Partition getPartition(String dbName, String tblName, String name) * @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; + default Partition getPartition(String catName, String dbName, String tblName, String name) + throws MetaException, UnknownTableException, NoSuchObjectException, TException{ + return new Partition(); + } /** @@ -1090,9 +1169,11 @@ Partition getPartition(String catName, String dbName, String tblName, String nam * @throws NoSuchObjectException no such partition * @throws TException thrift transport error */ - Partition getPartitionWithAuthInfo(String dbName, String tableName, + default Partition getPartitionWithAuthInfo(String dbName, String tableName, List pvals, String userName, List groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; + throws MetaException, UnknownTableException, NoSuchObjectException, TException{ + return new Partition(); + } /** * Get a Partition along with authorization information. @@ -1108,9 +1189,11 @@ Partition getPartitionWithAuthInfo(String dbName, String tableName, * @throws NoSuchObjectException no such partition * @throws TException thrift transport error */ - Partition getPartitionWithAuthInfo(String catName, String dbName, String tableName, + default Partition getPartitionWithAuthInfo(String catName, String dbName, String tableName, List pvals, String userName, List groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException; + throws MetaException, UnknownTableException, NoSuchObjectException, TException{ + return new Partition(); + } /** * Get a list of partittions for a table. @@ -1122,8 +1205,10 @@ Partition getPartitionWithAuthInfo(String catName, String dbName, String tableNa * @throws MetaException error accessing RDBMS. * @throws TException thrift transport error */ - List listPartitions(String db_name, String tbl_name, short max_parts) - throws NoSuchObjectException, MetaException, TException; + default List listPartitions(String db_name, String tbl_name, short max_parts) + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get a list of partittions for a table. @@ -1136,8 +1221,10 @@ List listPartitions(String db_name, String tbl_name, short max_parts) * @throws MetaException error accessing RDBMS. * @throws TException thrift transport error */ - List listPartitions(String catName, String db_name, String tbl_name, int max_parts) - throws NoSuchObjectException, MetaException, TException; + default List listPartitions(String catName, String db_name, String tbl_name, int max_parts) + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get a list of partitions from a table, returned in the form of PartitionSpecProxy @@ -1147,8 +1234,10 @@ List listPartitions(String catName, String db_name, String tbl_name, * @return a PartitionSpecProxy * @throws TException thrift transport error */ - PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, int maxParts) - throws TException; + default PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, int maxParts) + throws TException { + return null; + } /** * Get a list of partitions from a table, returned in the form of PartitionSpecProxy @@ -1159,8 +1248,10 @@ PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, int maxPa * @return a PartitionSpecProxy * @throws TException thrift transport error */ - PartitionSpecProxy listPartitionSpecs(String catName, String dbName, String tableName, - int maxParts) throws TException; + default PartitionSpecProxy listPartitionSpecs(String catName, String dbName, String tableName, int maxParts) + throws TException { + return null; + } /** * Get a list of partitions based on a (possibly partial) list of partition values. @@ -1174,8 +1265,10 @@ PartitionSpecProxy listPartitionSpecs(String catName, String dbName, String tabl * @throws MetaException error accessing the database or processing the partition values. * @throws TException thrift transport error. */ - List listPartitions(String db_name, String tbl_name, - List part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException; + default List listPartitions(String db_name, String tbl_name, + List part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get a list of partitions based on a (possibly partial) list of partition values. @@ -1190,9 +1283,11 @@ List listPartitions(String db_name, String tbl_name, * @throws MetaException error accessing the database or processing the partition values. * @throws TException thrift transport error. */ - List listPartitions(String catName, String db_name, String tbl_name, + default List listPartitions(String catName, String db_name, String tbl_name, List part_vals, int max_parts) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * List Names of partitions in a table. @@ -1204,8 +1299,10 @@ List listPartitions(String catName, String db_name, String tbl_name, * @throws MetaException Error accessing the RDBMS. * @throws TException thrift transport error */ - List listPartitionNames(String db_name, String tbl_name, - short max_parts) throws NoSuchObjectException, MetaException, TException; + default List listPartitionNames(String db_name, String tbl_name, + short max_parts) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * List Names of partitions in a table. @@ -1215,8 +1312,10 @@ List listPartitionNames(String db_name, String tbl_name, * @throws MetaException Error accessing the RDBMS. * @throws TException thrift transport error */ - GetPartitionNamesPsResponse listPartitionNamesRequest(GetPartitionNamesPsRequest req) - throws NoSuchObjectException, MetaException, TException; + default GetPartitionNamesPsResponse listPartitionNamesRequest(GetPartitionNamesPsRequest req) + throws NoSuchObjectException, MetaException, TException { + return new GetPartitionNamesPsResponse(); + } /** * List Names of partitions in a table. @@ -1229,8 +1328,10 @@ GetPartitionNamesPsResponse listPartitionNamesRequest(GetPartitionNamesPsRequest * @throws MetaException Error accessing the RDBMS. * @throws TException thrift transport error */ - List listPartitionNames(String catName, String db_name, String tbl_name, - int max_parts) throws NoSuchObjectException, MetaException, TException; + default List listPartitionNames(String catName, String db_name, String tbl_name, int max_parts) + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get a list of partition names matching a partial specification of the partition values. @@ -1246,9 +1347,10 @@ List listPartitionNames(String catName, String db_name, String tbl_name, * @throws TException thrift transport error. * @throws NoSuchObjectException no such table. */ - List listPartitionNames(String db_name, String tbl_name, - List part_vals, short max_parts) - throws MetaException, TException, NoSuchObjectException; + default List listPartitionNames(String db_name, String tbl_name, List part_vals, short max_parts) + throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * Get a list of partition names matching a partial specification of the partition values. @@ -1265,9 +1367,10 @@ List listPartitionNames(String db_name, String tbl_name, * @throws TException thrift transport error. * @throws NoSuchObjectException no such table. */ - List listPartitionNames(String catName, String db_name, String tbl_name, - List part_vals, int max_parts) - throws MetaException, TException, NoSuchObjectException; + default List listPartitionNames(String catName, String db_name, String tbl_name, List part_vals, + int max_parts) throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * Get a list of partition names matching the specified filter and return in order if specified. @@ -1277,8 +1380,10 @@ List listPartitionNames(String catName, String db_name, String tbl_name, * @throws TException thrift transport error. * @throws NoSuchObjectException no such table. */ - List listPartitionNames(PartitionsByExprRequest request) - throws MetaException, TException, NoSuchObjectException; + default List listPartitionNames(PartitionsByExprRequest request) + throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * Get a list of partition values @@ -1288,8 +1393,10 @@ List listPartitionNames(PartitionsByExprRequest request) * @throws TException thrift transport error * @throws NoSuchObjectException no such table */ - PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) - throws MetaException, TException, NoSuchObjectException; + default PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) + throws MetaException, TException, NoSuchObjectException { + return new PartitionValuesResponse(); + } /** * Get number of partitions matching specified filter @@ -1303,8 +1410,10 @@ PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) * @throws NoSuchObjectException no such table * @throws TException thrift transport error */ - int getNumPartitionsByFilter(String dbName, String tableName, - String filter) throws MetaException, NoSuchObjectException, TException; + default int getNumPartitionsByFilter(String dbName, String tableName, String filter) + throws MetaException, NoSuchObjectException, TException { + return 0; + } /** * Get number of partitions matching specified filter @@ -1319,8 +1428,10 @@ int getNumPartitionsByFilter(String dbName, String tableName, * @throws NoSuchObjectException no such table * @throws TException thrift transport error */ - int getNumPartitionsByFilter(String catName, String dbName, String tableName, - String filter) throws MetaException, NoSuchObjectException, TException; + default int getNumPartitionsByFilter(String catName, String dbName, String tableName, String filter) + throws MetaException, NoSuchObjectException, TException { + return 0; + } /** @@ -1337,8 +1448,10 @@ int getNumPartitionsByFilter(String catName, String dbName, String tableName, * @throws NoSuchObjectException No such table. * @throws TException thrift transport error */ - List listPartitionsByFilter(String db_name, String tbl_name, - String filter, short max_parts) throws MetaException, NoSuchObjectException, TException; + default List listPartitionsByFilter(String db_name, String tbl_name, String filter, short max_parts) + throws MetaException, NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get list of partitions matching specified filter @@ -1355,9 +1468,11 @@ List listPartitionsByFilter(String db_name, String tbl_name, * @throws NoSuchObjectException No such table. * @throws TException thrift transport error */ - List listPartitionsByFilter(String catName, String db_name, String tbl_name, + default List listPartitionsByFilter(String catName, String db_name, String tbl_name, String filter, int max_parts) - throws MetaException, NoSuchObjectException, TException; + throws MetaException, NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to @@ -1371,9 +1486,10 @@ List listPartitionsByFilter(String catName, String db_name, String tb * @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; + default PartitionSpecProxy listPartitionSpecsByFilter(String db_name, String tbl_name, String filter, int max_parts) + throws MetaException, NoSuchObjectException, TException { + return null; + } /** * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to @@ -1388,9 +1504,10 @@ PartitionSpecProxy listPartitionSpecsByFilter(String db_name, String tbl_name, * @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; + default PartitionSpecProxy listPartitionSpecsByFilter(String catName, String db_name, String tbl_name, + String filter, int max_parts) throws MetaException, NoSuchObjectException, TException { + return null; + } /** * Get list of {@link PartitionSpec} matching specified serialized expression. @@ -1398,8 +1515,9 @@ PartitionSpecProxy listPartitionSpecsByFilter(String catName, String db_name, St * @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 listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) - throws TException; + default boolean listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) throws TException { + return false; + } /** * Get list of partitions matching specified serialized expression @@ -1414,9 +1532,11 @@ boolean listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) - throws TException; + throws TException { + return false; + } /** * Get list of partitions matching specified serialized expression @@ -1432,9 +1552,10 @@ boolean listPartitionsByExpr(String db_name, String tbl_name, * @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 result) - throws TException; + default boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, byte[] expr, + String default_partition_name, int max_parts, List result) throws TException { + return false; + } /** * Get list of partitions matching specified serialized expression @@ -1456,9 +1577,11 @@ boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, by * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List listPartitionsWithAuthInfo(String dbName, + default List listPartitionsWithAuthInfo(String dbName, String tableName, short maxParts, String userName, List groupNames) - throws MetaException, TException, NoSuchObjectException; + throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * List partitions, fetching the authorization information along with the partitions. @@ -1468,8 +1591,10 @@ List listPartitionsWithAuthInfo(String dbName, * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - GetPartitionsPsWithAuthResponse listPartitionsWithAuthInfoRequest(GetPartitionsPsWithAuthRequest req) - throws MetaException, TException, NoSuchObjectException; + default GetPartitionsPsWithAuthResponse listPartitionsWithAuthInfoRequest(GetPartitionsPsWithAuthRequest req) + throws MetaException, TException, NoSuchObjectException { + return new GetPartitionsPsWithAuthResponse(); + } /** * List partitions, fetching the authorization information along with the partitions. @@ -1484,9 +1609,11 @@ GetPartitionsPsWithAuthResponse listPartitionsWithAuthInfoRequest(GetPartitionsP * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List listPartitionsWithAuthInfo(String catName, String dbName, String tableName, + default List listPartitionsWithAuthInfo(String catName, String dbName, String tableName, int maxParts, String userName, List groupNames) - throws MetaException, TException, NoSuchObjectException; + throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * Get partitions by a list of partition names. @@ -1500,8 +1627,10 @@ List listPartitionsWithAuthInfo(String catName, String dbName, String * @deprecated Use {@link #getPartitionsByNames(GetPartitionsByNamesRequest)} instead */ @Deprecated - List getPartitionsByNames(String db_name, String tbl_name, - List part_names) throws NoSuchObjectException, MetaException, TException; + default List getPartitionsByNames(String db_name, String tbl_name, + List part_names) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get partitions by a list of partition names. @@ -1511,8 +1640,10 @@ List getPartitionsByNames(String db_name, String tbl_name, * @throws MetaException error accessing the RDBMS. * @throws TException thrift transport error */ - PartitionsResponse getPartitionsRequest(PartitionsRequest req) - throws NoSuchObjectException, MetaException, TException; + default PartitionsResponse getPartitionsRequest(PartitionsRequest req) + throws NoSuchObjectException, MetaException, TException { + return new PartitionsResponse(); + } /** * Get partitions by a list of partition names. @@ -1522,7 +1653,9 @@ PartitionsResponse getPartitionsRequest(PartitionsRequest req) * @throws MetaException error accessing the RDBMS. * @throws TException thrift transport error */ - GetPartitionsByNamesResult getPartitionsByNames(GetPartitionsByNamesRequest req) throws TException; + default GetPartitionsByNamesResult getPartitionsByNames(GetPartitionsByNamesRequest req) throws TException { + return new GetPartitionsByNamesResult(); + } /** * List partitions along with privilege information for a user or groups @@ -1537,9 +1670,11 @@ PartitionsResponse getPartitionsRequest(PartitionsRequest req) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List listPartitionsWithAuthInfo(String dbName, + default List listPartitionsWithAuthInfo(String dbName, String tableName, List partialPvals, short maxParts, String userName, - List groupNames) throws MetaException, TException, NoSuchObjectException; + List groupNames) throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * List partitions along with privilege information for a user or groups @@ -1554,10 +1689,11 @@ List listPartitionsWithAuthInfo(String dbName, * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List listPartitionsWithAuthInfo(String catName, String dbName, String tableName, - List partialPvals, int maxParts, String userName, - List groupNames) - throws MetaException, TException, NoSuchObjectException; + default List listPartitionsWithAuthInfo( + String catName, String dbName, String tableName, List partialPvals, int maxParts, String userName, + List groupNames) throws MetaException, TException, NoSuchObjectException { + return Collections.emptyList(); + } /** * Mark an event as having occurred on a partition. @@ -1573,9 +1709,9 @@ List listPartitionsWithAuthInfo(String catName, String dbName, String * @throws UnknownPartitionException no such partition * @throws InvalidPartitionException partition partKVs is invalid */ - void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, + default void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException {} /** * Mark an event as having occurred on a partition. @@ -1592,9 +1728,9 @@ void markPartitionForEvent(String db_name, String tbl_name, Map p * @throws UnknownPartitionException no such partition * @throws InvalidPartitionException partition partKVs is invalid */ - void markPartitionForEvent(String catName, String db_name, String tbl_name, Map partKVs, + default void markPartitionForEvent(String catName, String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException {} /** * Determine whether a partition has been marked with a particular event type. @@ -1610,9 +1746,11 @@ void markPartitionForEvent(String catName, String db_name, String tbl_name, Map< * @throws UnknownPartitionException no such partition * @throws InvalidPartitionException partition partKVs is invalid */ - boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, + default boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { + return false; + } /** * Determine whether a partition has been marked with a particular event type. @@ -1629,16 +1767,18 @@ boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, + default boolean isPartitionMarkedForEvent(String catName, String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException; + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { + return false; + } /** * @param partVals * @throws TException * @throws MetaException */ - void validatePartitionNameCharacters(List partVals) throws TException, MetaException; + default void validatePartitionNameCharacters(List partVals) throws TException, MetaException{} /** * Dry run that translates table @@ -1647,8 +1787,10 @@ boolean isPartitionMarkedForEvent(String catName, String db_name, String tbl_nam * * a table object * * @throws HiveException */ - public Table getTranslateTableDryrun(Table tbl) throws AlreadyExistsException, - InvalidObjectException, MetaException, NoSuchObjectException, TException; + default Table getTranslateTableDryrun(Table tbl) throws AlreadyExistsException, + InvalidObjectException, MetaException, NoSuchObjectException, TException { + return new Table(); + } /** * @param tbl @@ -1683,8 +1825,8 @@ void createTable(CreateTableRequest request) throws AlreadyExistsException, * @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; + default void alter_table(String databaseName, String tblName, Table table) + throws InvalidOperationException, MetaException, TException {} /** * Alter a table. Equivalent to @@ -1718,17 +1860,17 @@ default void alter_table(String catName, String dbName, String tblName, Table ne * @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, + default void alter_table(String catName, String dbName, String tblName, Table newTable, EnvironmentContext envContext) - throws InvalidOperationException, MetaException, TException; + 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; + default void alter_table(String defaultDatabaseName, String tblName, Table table, + boolean cascade) throws InvalidOperationException, MetaException, TException {} /** * Alter a table. @@ -1743,13 +1885,13 @@ void alter_table(String defaultDatabaseName, String tblName, Table table, * @throws TException general thrift exception */ @Deprecated - void alter_table_with_environmentContext(String databaseName, String tblName, Table table, + default void alter_table_with_environmentContext(String databaseName, String tblName, Table table, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, - TException; + TException {} - void alter_table(String catName, String databaseName, String tblName, Table table, + default void alter_table(String catName, String databaseName, String tblName, Table table, EnvironmentContext environmentContext, String validWriteIdList) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * Create a new database. * @param db database object. If the catalog name is null it will be assumed to be @@ -1844,8 +1986,8 @@ default void dropDatabase(String catName, String dbName, boolean deleteData, boo * @throws MetaException something went wrong, usually in the RDBMS. * @throws TException general thrift error. */ - void alterDatabase(String name, Database db) - throws NoSuchObjectException, MetaException, TException; + default void alterDatabase(String name, Database db) + throws NoSuchObjectException, MetaException, TException {} /** * Alter a database. @@ -1857,8 +1999,8 @@ void alterDatabase(String name, Database db) * @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; + default void alterDatabase(String catName, String dbName, Database newDb) + throws NoSuchObjectException, MetaException, TException {} /** * Create a new dataconnector. @@ -1868,8 +2010,8 @@ void alterDatabase(String catName, String dbName, Database newDb) * @throws MetaException something went wrong, usually in the RDBMS * @throws TException general thrift error */ - void createDataConnector(DataConnector connector) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException; + default void createDataConnector(DataConnector connector) + throws InvalidObjectException, AlreadyExistsException, MetaException, TException {} /** * Drop a dataconnector. @@ -1881,8 +2023,8 @@ void createDataConnector(DataConnector connector) * @throws MetaException something went wrong, usually either in the RDMBS or in storage. * @throws TException general thrift error. */ - void dropDataConnector(String name, boolean ifNotExists, boolean checkReferences) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException; + default void dropDataConnector(String name, boolean ifNotExists, boolean checkReferences) + throws NoSuchObjectException, InvalidOperationException, MetaException, TException {} /** * Alter a dataconnector. @@ -1892,8 +2034,8 @@ void dropDataConnector(String name, boolean ifNotExists, boolean checkReferences * @throws MetaException Operation could not be completed, usually in the RDBMS. * @throws TException thrift transport layer error. */ - void alterDataConnector(String name, DataConnector connector) - throws NoSuchObjectException, MetaException, TException; + default void alterDataConnector(String name, DataConnector connector) + throws NoSuchObjectException, MetaException, TException {} /** * Get the dataconnector by name @@ -1901,8 +2043,10 @@ void alterDataConnector(String name, DataConnector connector) * @throws MetaException error complete the operation * @throws TException thrift transport error */ - DataConnector getDataConnector(String name) - throws MetaException, TException; + default DataConnector getDataConnector(String name) + throws MetaException, TException { + return new DataConnector(); + } /** * Get the names of all dataconnectors in the MetaStore. @@ -1910,7 +2054,9 @@ DataConnector getDataConnector(String name) * @throws MetaException error accessing RDBMS. * @throws TException thrift transport error */ - List getAllDataConnectorNames() throws MetaException, TException; + default List getAllDataConnectorNames() throws MetaException, TException { + return Collections.emptyList(); + } /** * Drop a partition. @@ -1924,9 +2070,11 @@ DataConnector getDataConnector(String name) * @throws MetaException error accessing the RDBMS or the storage. * @throws TException thrift transport error */ - boolean dropPartition(String db_name, String tbl_name, + default boolean dropPartition(String db_name, String tbl_name, List part_vals, boolean deleteData) throws NoSuchObjectException, - MetaException, TException; + MetaException, TException { + return false; + } /** * Drop a partition. @@ -1941,9 +2089,11 @@ boolean dropPartition(String db_name, String tbl_name, * @throws MetaException error accessing the RDBMS or the storage. * @throws TException thrift transport error */ - boolean dropPartition(String catName, String db_name, String tbl_name, + default boolean dropPartition(String catName, String db_name, String tbl_name, List part_vals, boolean deleteData) throws NoSuchObjectException, - MetaException, TException; + MetaException, TException { + return false; + } /** * Drop a partition with the option to purge the partition data directly, @@ -1957,9 +2107,11 @@ boolean dropPartition(String catName, String db_name, String tbl_name, * @throws MetaException error accessing the RDBMS or the storage. * @throws TException thrift transport error. */ - boolean dropPartition(String db_name, String tbl_name, List part_vals, + default boolean dropPartition(String db_name, String tbl_name, List part_vals, PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return false; + } /** * Drop a partition with the option to purge the partition data directly, @@ -1974,9 +2126,11 @@ boolean dropPartition(String db_name, String tbl_name, List part_vals, * @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 part_vals, + default boolean dropPartition(String catName, String db_name, String tbl_name, List part_vals, PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return false; + } /** * Drop partitions based on an expression. @@ -1994,9 +2148,11 @@ boolean dropPartition(String catName, String db_name, String tbl_name, List dropPartitions(String dbName, String tblName, + default List dropPartitions(String dbName, String tblName, List> partExprs, boolean deleteData, - boolean ifExists) throws NoSuchObjectException, MetaException, TException; + boolean ifExists) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Drop partitions based on an expression. @@ -2024,9 +2180,16 @@ default List dropPartitions(String catName, String dbName, String tbl .deleteData(deleteData) .ifExists(ifExists)); } + @Deprecated + default List dropPartitions(String dbName, String tblName, + List> partExprs, boolean deleteData, + boolean ifExists, boolean needResults) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Drop partitions based on an expression. +>>>>>>> be2c0f0b12d (HIVE-28658 Add Iceberg REST Catalog client support) * @param catName catalog name. * @param dbName database name. * @param tblName table name. @@ -2066,10 +2229,12 @@ default List dropPartitions(String catName, String dbName, String tbl * @throws MetaException error access the RDBMS or storage. * @throws TException On failure */ - List dropPartitions(String dbName, String tblName, + default List dropPartitions(String dbName, String tblName, List> partExprs, PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Generalization of dropPartitions(), @@ -2083,10 +2248,12 @@ List dropPartitions(String dbName, String tblName, * @throws MetaException error access the RDBMS or storage. * @throws TException On failure */ - List dropPartitions(String catName, String dbName, String tblName, + default List dropPartitions(String catName, String dbName, String tblName, List> partExprs, PartitionDropOptions options) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } List dropPartitions(String catName, String dbName, String tblName, List> partExprs, PartitionDropOptions options, EnvironmentContext context) @@ -2103,9 +2270,11 @@ List dropPartitions(String catName, String dbName, String tblName, * @throws MetaException error accessing the RDBMS or storage * @throws TException thrift transport error */ - boolean dropPartition(String db_name, String tbl_name, + default boolean dropPartition(String db_name, String tbl_name, String name, boolean deleteData) throws NoSuchObjectException, - MetaException, TException; + MetaException, TException { + return false; + } /** * Drop a partition. @@ -2119,9 +2288,11 @@ boolean dropPartition(String db_name, String tbl_name, * @throws MetaException error accessing the RDBMS or storage * @throws TException thrift transport error */ - boolean dropPartition(String catName, String db_name, String tbl_name, + default boolean dropPartition(String catName, String db_name, String tbl_name, String name, boolean deleteData) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return false; + } /** * updates a partition to new partition @@ -2139,8 +2310,8 @@ boolean dropPartition(String catName, String db_name, String tbl_name, * @throws TException * if error in communicating with metastore server */ - void alter_partition(String dbName, String tblName, Partition newPart) - throws InvalidOperationException, MetaException, TException; + default void alter_partition(String dbName, String tblName, Partition newPart) + throws InvalidOperationException, MetaException, TException {} /** * updates a partition to new partition @@ -2159,13 +2330,13 @@ void alter_partition(String dbName, String tblName, Partition newPart) * if error in communicating with metastore server */ @Deprecated - void alter_partition(String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException; + default void alter_partition(String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) + throws InvalidOperationException, MetaException, TException {} - void alter_partition(String catName, String dbName, String tblName, Partition newPart, + default void alter_partition(String catName, String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext, String writeIdList) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * updates a partition to new partition @@ -2183,9 +2354,9 @@ void alter_partition(String catName, String dbName, String tblName, Partition ne * @throws TException * if error in communicating with metastore server */ - void alter_partition(String catName, String dbName, String tblName, Partition newPart, + default void alter_partition(String catName, String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * updates a list of partitions @@ -2204,8 +2375,8 @@ void alter_partition(String catName, String dbName, String tblName, Partition ne * if error in communicating with metastore server */ @Deprecated - void alter_partitions(String dbName, String tblName, List newParts) - throws InvalidOperationException, MetaException, TException; + default void alter_partitions(String dbName, String tblName, List newParts) + throws InvalidOperationException, MetaException, TException {} /** * updates a list of partitions @@ -2225,14 +2396,14 @@ void alter_partitions(String dbName, String tblName, List newParts) * if error in communicating with metastore server */ @Deprecated - void alter_partitions(String dbName, String tblName, List newParts, + default void alter_partitions(String dbName, String tblName, List newParts, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} - void alter_partitions(String dbName, String tblName, List newParts, + default void alter_partitions(String dbName, String tblName, List newParts, EnvironmentContext environmentContext, String writeIdList, long writeId) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * updates a list of partitions @@ -2251,10 +2422,10 @@ void alter_partitions(String dbName, String tblName, List newParts, * @throws TException * if error in communicating with metastore server */ - void alter_partitions(String catName, String dbName, String tblName, List newParts, + default void alter_partitions(String catName, String dbName, String tblName, List newParts, EnvironmentContext environmentContext, String writeIdList, long writeId) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * rename a partition to a new partition @@ -2275,9 +2446,9 @@ void alter_partitions(String catName, String dbName, String tblName, List part_vals, + default void renamePartition(final String dbname, final String tableName, final List part_vals, final Partition newPart) - throws InvalidOperationException, MetaException, TException; + throws InvalidOperationException, MetaException, TException {} /** * rename a partition to a new partition @@ -2303,9 +2474,9 @@ default void renamePartition(String catName, String dbname, String tableName, Li renamePartition(catName, dbname, tableName, part_vals, newPart, validWriteIds, 0, false); } - void renamePartition(String catName, String dbname, String tableName, List part_vals, + default void renamePartition(String catName, String dbname, String tableName, List part_vals, Partition newPart, String validWriteIds, long txnId, boolean makeCopy) - throws TException; + throws TException {} /** * Get schema for a table, excluding the partition columns. @@ -2317,9 +2488,11 @@ void renamePartition(String catName, String dbname, String tableName, List getFields(String db, String tableName) + default List getFields(String db, String tableName) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return Collections.emptyList(); + } /** * Get schema for a table, excluding the partition columns. @@ -2332,9 +2505,11 @@ List getFields(String db, String tableName) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List getFields(String catName, String db, String tableName) + default List getFields(String catName, String db, String tableName) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return Collections.emptyList(); + } /** * Get schema for a table, excluding the partition columns. @@ -2345,9 +2520,11 @@ List getFields(String catName, String db, String tableName) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - GetFieldsResponse getFieldsRequest(GetFieldsRequest req) + default GetFieldsResponse getFieldsRequest(GetFieldsRequest req) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return new GetFieldsResponse(); + } /** * Get schema for a table, including the partition columns. @@ -2359,9 +2536,11 @@ GetFieldsResponse getFieldsRequest(GetFieldsRequest req) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List getSchema(String db, String tableName) + default List getSchema(String db, String tableName) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return Collections.emptyList(); + } /** * Get schema for a table, including the partition columns. @@ -2374,9 +2553,11 @@ List getSchema(String db, String tableName) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List getSchema(String catName, String db, String tableName) + default List getSchema(String catName, String db, String tableName) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return Collections.emptyList(); + } /** * Get schema for a table, including the partition columns. @@ -2387,9 +2568,11 @@ List getSchema(String catName, String db, String tableName) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - GetSchemaResponse getSchemaRequest(GetSchemaRequest req) + default GetSchemaResponse getSchemaRequest(GetSchemaRequest req) throws MetaException, TException, UnknownTableException, - UnknownDBException; + UnknownDBException { + return new GetSchemaResponse(); + } /** * @param name @@ -2400,8 +2583,10 @@ GetSchemaResponse getSchemaRequest(GetSchemaRequest req) * @throws TException * @throws ConfigValSecurityException */ - String getConfigValue(String name, String defaultValue) - throws TException, ConfigValSecurityException; + default String getConfigValue(String name, String defaultValue) + throws TException, ConfigValSecurityException { + return "50"; + } /** * @@ -2411,8 +2596,10 @@ String getConfigValue(String name, String defaultValue) * @throws MetaException * @throws TException */ - List partitionNameToVals(String name) - throws MetaException, TException; + default List partitionNameToVals(String name) + throws MetaException, TException { + return Collections.emptyList(); + } /** * * @param name @@ -2421,8 +2608,10 @@ List partitionNameToVals(String name) * @throws MetaException * @throws TException */ - Map partitionNameToSpec(String name) - throws MetaException, TException; + default Map partitionNameToSpec(String name) + throws MetaException, TException { + return Collections.emptyMap(); + } /** * Write table level column statistics to persistent store @@ -2434,9 +2623,11 @@ Map partitionNameToSpec(String name) * @throws TException * @throws InvalidInputException */ - boolean updateTableColumnStatistics(ColumnStatistics statsObj) + default boolean updateTableColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, - InvalidInputException; + InvalidInputException { + return false; +} /** * Write partition level column statistics to persistent store @@ -2448,9 +2639,11 @@ boolean updateTableColumnStatistics(ColumnStatistics statsObj) * @throws TException * @throws InvalidInputException */ - boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) + default boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, - InvalidInputException; + InvalidInputException { + return false; + } /** * Get the column statistics for a set of columns in a table. This should only be used for @@ -2465,12 +2658,16 @@ boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List getTableColumnStatistics(String dbName, String tableName, - List colNames, String engine) throws NoSuchObjectException, MetaException, TException; + default List getTableColumnStatistics(String dbName, String tableName, + List colNames, String engine) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } - List getTableColumnStatistics(String dbName, String tableName, + default List getTableColumnStatistics(String dbName, String tableName, List colNames, String engine, String validWriteIdList) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get the column statistics for a set of columns in a table. This should only be used for @@ -2486,12 +2683,16 @@ List getTableColumnStatistics(String dbName, String tableNa * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - List getTableColumnStatistics(String catName, String dbName, String tableName, - List colNames, String engine) throws NoSuchObjectException, MetaException, TException; + default List getTableColumnStatistics(String catName, String dbName, String tableName, + List colNames, String engine) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } - List getTableColumnStatistics(String catName, String dbName, String tableName, + default List getTableColumnStatistics(String catName, String dbName, String tableName, List colNames, String engine, String validWriteIdList) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } /** * Get the column statistics for a set of columns in a partition. * @param dbName database name @@ -2505,14 +2706,18 @@ List getTableColumnStatistics(String catName, String dbName * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Map> getPartitionColumnStatistics(String dbName, + default Map> getPartitionColumnStatistics(String dbName, String tableName, List partNames, List colNames, String engine) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyMap(); + } - Map> getPartitionColumnStatistics(String dbName, + default Map> getPartitionColumnStatistics(String dbName, String tableName, List partNames, List colNames, String engine, String validWriteIdList) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyMap(); + } /** * Get the column statistics for a set of columns in a partition. @@ -2528,16 +2733,19 @@ Map> getPartitionColumnStatistics(String dbNam * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Map> getPartitionColumnStatistics( + default Map> getPartitionColumnStatistics( String catName, String dbName, String tableName, List partNames, List colNames, - String engine) throws NoSuchObjectException, MetaException, TException; + String engine) throws NoSuchObjectException, MetaException, TException { + return Collections.emptyMap(); + } - Map> getPartitionColumnStatistics( + default Map> getPartitionColumnStatistics( String catName, String dbName, String tableName, List partNames, List colNames, String engine, String validWriteIdList) - throws NoSuchObjectException, MetaException, TException; - + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyMap(); + } /** * Delete partition level column statistics given dbName, tableName, partName and colName, or * all columns in a partition. @@ -2672,9 +2880,11 @@ default boolean deleteTableColumnStatistics(String catName, String dbName, Strin * @return boolean indicating the outcome of the operation * @throws TException thrift transport error */ - public boolean deleteColumnStatistics(DeleteColumnStatisticsRequest req) throws TException; + default boolean deleteColumnStatistics(DeleteColumnStatisticsRequest req) throws TException { + return false; + } - void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException; + default void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException {} /** * @param role @@ -2683,8 +2893,10 @@ default boolean deleteTableColumnStatistics(String catName, String dbName, Strin * @throws MetaException * @throws TException */ - boolean create_role(Role role) - throws MetaException, TException; + default boolean create_role(Role role) + throws MetaException, TException { + return false; + } /** * @param role_name @@ -2694,7 +2906,9 @@ boolean create_role(Role role) * @throws MetaException * @throws TException */ - boolean drop_role(String role_name) throws MetaException, TException; + default boolean drop_role(String role_name) throws MetaException, TException{ + return false; + } /** * list all role names @@ -2702,7 +2916,9 @@ boolean create_role(Role role) * @throws TException * @throws MetaException */ - List listRoleNames() throws MetaException, TException; + default List listRoleNames() throws MetaException, TException { + return Collections.emptyList(); + } /** * @@ -2716,9 +2932,11 @@ boolean create_role(Role role) * @throws MetaException * @throws TException */ - boolean grant_role(String role_name, String user_name, + default boolean grant_role(String role_name, String user_name, PrincipalType principalType, String grantor, PrincipalType grantorType, - boolean grantOption) throws MetaException, TException; + boolean grantOption) throws MetaException, TException{ + return false; + } /** * @param role_name @@ -2731,8 +2949,10 @@ boolean grant_role(String role_name, String user_name, * @throws MetaException * @throws TException */ - boolean revoke_role(String role_name, String user_name, - PrincipalType principalType, boolean grantOption) throws MetaException, TException; + default boolean revoke_role(String role_name, String user_name, + PrincipalType principalType, boolean grantOption) throws MetaException, TException{ + return false; + } /** * @@ -2742,8 +2962,10 @@ boolean revoke_role(String role_name, String user_name, * @throws MetaException * @throws TException */ - List list_roles(String principalName, PrincipalType principalType) - throws MetaException, TException; + default List list_roles(String principalName, PrincipalType principalType) + throws MetaException, TException { + return Collections.emptyList(); + } /** * Return the privileges that the user, group have directly and indirectly through roles @@ -2755,9 +2977,11 @@ List list_roles(String principalName, PrincipalType principalType) * @throws MetaException * @throws TException */ - PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, + default PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, String user_name, List group_names) throws MetaException, - TException; + TException { + return new PrincipalPrivilegeSet(); + } /** * Return the privileges that this principal has directly over the object (not through roles). @@ -2768,9 +2992,11 @@ PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, * @throws MetaException * @throws TException */ - List list_privileges(String principal_name, + default List list_privileges(String principal_name, PrincipalType principal_type, HiveObjectRef hiveObject) - throws MetaException, TException; + throws MetaException, TException { + return Collections.emptyList(); + } /** * @param privileges @@ -2778,8 +3004,10 @@ List list_privileges(String principal_name, * @throws MetaException * @throws TException */ - boolean grant_privileges(PrivilegeBag privileges) - throws MetaException, TException; + default boolean grant_privileges(PrivilegeBag privileges) + throws MetaException, TException { + return false; + } /** * @param privileges @@ -2787,8 +3015,10 @@ boolean grant_privileges(PrivilegeBag privileges) * @throws MetaException * @throws TException */ - boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) - throws MetaException, TException; + default boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) + throws MetaException, TException { + return false; + } /** * @param authorizer @@ -2797,8 +3027,10 @@ boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) * @throws MetaException * @throws TException */ - boolean refresh_privileges(HiveObjectRef objToRefresh, String authorizer, PrivilegeBag grantPrivileges) - throws MetaException, TException; + default boolean refresh_privileges(HiveObjectRef objToRefresh, String authorizer, PrivilegeBag grantPrivileges) + throws MetaException, TException { + return false; + } /** * This is expected to be a no-op when in local mode, @@ -2809,8 +3041,10 @@ boolean refresh_privileges(HiveObjectRef objToRefresh, String authorizer, Privil * @throws MetaException * @throws TException */ - String getDelegationToken(String owner, String renewerKerberosPrincipalName) - throws MetaException, TException; + default String getDelegationToken(String owner, String renewerKerberosPrincipalName) + throws MetaException, TException { + return ""; + } /** * @param tokenStrForm @@ -2818,33 +3052,52 @@ String getDelegationToken(String owner, String renewerKerberosPrincipalName) * @throws MetaException * @throws TException */ - long renewDelegationToken(String tokenStrForm) throws MetaException, TException; + default long renewDelegationToken(String tokenStrForm) throws MetaException, TException { + return 0; + } /** * @param tokenStrForm * @throws MetaException * @throws TException */ - void cancelDelegationToken(String tokenStrForm) throws MetaException, TException; + default void cancelDelegationToken(String tokenStrForm) throws MetaException, TException {} - String getTokenStrForm() throws IOException; + default String getTokenStrForm() throws IOException { + return ""; + } - boolean addToken(String tokenIdentifier, String delegationToken) throws TException; + default boolean addToken(String tokenIdentifier, String delegationToken) throws TException { + return false; + } - boolean removeToken(String tokenIdentifier) throws TException; + default boolean removeToken(String tokenIdentifier) throws TException { + return false; + } - String getToken(String tokenIdentifier) throws TException; + default String getToken(String tokenIdentifier) throws TException { + return ""; + } + + default List getAllTokenIdentifiers() throws TException { + return Collections.emptyList(); + } - List getAllTokenIdentifiers() throws TException; + default int addMasterKey(String key) throws MetaException, TException { + return 0; + } - int addMasterKey(String key) throws MetaException, TException; + default void updateMasterKey(Integer seqNo, String key) + throws NoSuchObjectException, MetaException, TException {} - void updateMasterKey(Integer seqNo, String key) - throws NoSuchObjectException, MetaException, TException; + default boolean removeMasterKey(Integer keySeq) throws TException { + return false; + } - boolean removeMasterKey(Integer keySeq) throws TException; - String[] getMasterKeys() throws TException; + default String[] getMasterKeys() throws TException { + return new String[0]; + } /** * Create a new function. @@ -2853,8 +3106,8 @@ void updateMasterKey(Integer seqNo, String key) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - void createFunction(Function func) - throws InvalidObjectException, MetaException, TException; + default void createFunction(Function func) + throws InvalidObjectException, MetaException, TException {} /** * Alter a function. @@ -2865,8 +3118,8 @@ void createFunction(Function func) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - void alterFunction(String dbName, String funcName, Function newFunction) - throws InvalidObjectException, MetaException, TException; + default void alterFunction(String dbName, String funcName, Function newFunction) + throws InvalidObjectException, MetaException, TException {} /** * Alter a function. @@ -2878,8 +3131,8 @@ void alterFunction(String dbName, String funcName, Function newFunction) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - void alterFunction(String catName, String dbName, String funcName, Function newFunction) - throws InvalidObjectException, MetaException, TException; + default void alterFunction(String catName, String dbName, String funcName, Function newFunction) + throws InvalidObjectException, MetaException, TException {} /** * Drop a function. @@ -2891,8 +3144,8 @@ void alterFunction(String catName, String dbName, String funcName, Function newF * @throws InvalidInputException not sure when this is thrown * @throws TException thrift transport error */ - void dropFunction(String dbName, String funcName) throws MetaException, - NoSuchObjectException, InvalidObjectException, InvalidInputException, TException; + default void dropFunction(String dbName, String funcName) throws MetaException, + NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {} /** * Drop a function. @@ -2905,8 +3158,8 @@ void dropFunction(String dbName, String funcName) throws MetaException, * @throws InvalidInputException not sure when this is thrown * @throws TException thrift transport error */ - void dropFunction(String catName, String dbName, String funcName) throws MetaException, - NoSuchObjectException, InvalidObjectException, InvalidInputException, TException; + default void dropFunction(String catName, String dbName, String funcName) throws MetaException, + NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {} /** * Get a function. @@ -2915,8 +3168,10 @@ void dropFunction(String catName, String dbName, String funcName) throws MetaExc * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Function getFunction(String dbName, String funcName) - throws MetaException, TException; + default Function getFunction(String dbName, String funcName) + throws MetaException, TException { + return new Function(); + } /** * Get a function. @@ -2926,8 +3181,10 @@ Function getFunction(String dbName, String funcName) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - Function getFunction(String catName, String dbName, String funcName) - throws MetaException, TException; + default Function getFunction(String catName, String dbName, String funcName) + throws MetaException, TException { + return new Function(); + } /** * Get all functions matching a pattern @@ -2937,16 +3194,20 @@ Function getFunction(String catName, String dbName, String funcName) * @throws TException thrift transport error */ @Deprecated - List getFunctions(String dbName, String pattern) - throws MetaException, TException; + default List getFunctions(String dbName, String pattern) + throws MetaException, TException { + return Collections.emptyList(); + } /** * Get all functions matching a pattern * @param functionRequest function request. * @throws TException thrift transport error */ - GetFunctionsResponse getFunctionsRequest(GetFunctionsRequest functionRequest) - throws TException; + default GetFunctionsResponse getFunctionsRequest(GetFunctionsRequest functionRequest) + throws TException { + return new GetFunctionsResponse(); + } /** * Get all functions matching a pattern * @param catName catalog name. @@ -2956,8 +3217,10 @@ GetFunctionsResponse getFunctionsRequest(GetFunctionsRequest functionRequest) * @throws TException thrift transport error */ @Deprecated - List getFunctions(String catName, String dbName, String pattern) - throws MetaException, TException; + default List getFunctions(String catName, String dbName, String pattern) + throws MetaException, TException { + return Collections.emptyList(); + } /** * Get all functions in the default catalog. @@ -2965,16 +3228,22 @@ List getFunctions(String catName, String dbName, String pattern) * @throws MetaException error accessing the RDBMS * @throws TException thrift transport error */ - GetAllFunctionsResponse getAllFunctions() throws MetaException, TException; + default GetAllFunctionsResponse getAllFunctions() throws MetaException, TException { + return new GetAllFunctionsResponse(); + } - GetOpenTxnsResponse getOpenTxns() throws TException ; + default GetOpenTxnsResponse getOpenTxns() throws TException { + return new GetOpenTxnsResponse(); + } /** * Get a structure that details valid transactions. * @return list of valid transactions * @throws TException */ - ValidTxnList getValidTxns() throws TException; + default ValidTxnList getValidTxns() throws TException { + return new ValidReadTxnList(); + } /** * Get a structure that details valid transactions. @@ -2983,7 +3252,9 @@ List getFunctions(String catName, String dbName, String pattern) * @return list of valid transactions and also valid write IDs for each input table. * @throws TException */ - ValidTxnList getValidTxns(long currentTxn) throws TException; + default ValidTxnList getValidTxns(long currentTxn) throws TException { + return new ValidReadTxnList(); + } /** * Get a structure that details valid transactions. @@ -2993,7 +3264,9 @@ List getFunctions(String catName, String dbName, String pattern) * @return list of valid transactions and also valid write IDs for each input table. * @throws TException */ - ValidTxnList getValidTxns(long currentTxn, List excludeTxnTypes) throws TException; + default ValidTxnList getValidTxns(long currentTxn, List excludeTxnTypes) throws TException { + return new ValidReadTxnList(); + } /** * Get a structure that details valid write ids. @@ -3001,7 +3274,9 @@ List getFunctions(String catName, String dbName, String pattern) * @return list of valid write ids for the given table * @throws TException */ - ValidWriteIdList getValidWriteIds(String fullTableName) throws TException; + default ValidWriteIdList getValidWriteIds(String fullTableName) throws TException { + return new ValidCleanerWriteIdList("", 0); + } /** * Get a structure that details valid write ids. @@ -3010,7 +3285,9 @@ List getFunctions(String catName, String dbName, String pattern) * @return list of valid write ids for the given table * @throws TException */ - ValidWriteIdList getValidWriteIds(String fullTableName, Long writeId) throws TException; + default ValidWriteIdList getValidWriteIds(String fullTableName, Long writeId) throws TException { + return new ValidCleanerWriteIdList("", 0); + } /** * Get a structure that details valid write ids list for all tables read by current txn. @@ -3020,15 +3297,17 @@ List getFunctions(String catName, String dbName, String pattern) * @return list of valid write ids for the given list of tables. * @throws TException */ - List getValidWriteIds(List tablesList, String validTxnList) - throws TException; + default List getValidWriteIds(List tablesList, String validTxnList) + throws TException { + return Collections.emptyList(); + } /** * Persists minOpenWriteId list to identify obsolete directories eligible for cleanup * @param txnId transaction identifier * @param writeIds list of minOpenWriteId */ - void addWriteIdsToMinHistory(long txnId, Map writeIds) throws TException; + default void addWriteIdsToMinHistory(long txnId, Map writeIds) throws TException {} /** * Initiate a transaction. @@ -3038,7 +3317,9 @@ List getValidWriteIds(List tablesList, String validT * @return transaction identifier * @throws TException */ - long openTxn(String user) throws TException; + default long openTxn(String user) throws TException { + return 0; + } /** * Initiate a transaction with given type. @@ -3047,7 +3328,9 @@ List getValidWriteIds(List tablesList, String validT * @return transaction identifier * @throws TException */ - long openTxn(String user, TxnType txnType) throws TException; + default long openTxn(String user, TxnType txnType) throws TException { + return 0; + } /** * Initiate a repl replayed or hive replication transaction (dump/load). @@ -3062,7 +3345,9 @@ List getValidWriteIds(List tablesList, String validT * @return transaction identifiers * @throws TException */ - List replOpenTxn(String replPolicy, List srcTxnIds, String user, TxnType txnType) throws TException; + default List replOpenTxn(String replPolicy, List srcTxnIds, String user, TxnType txnType) throws TException { + return Collections.emptyList(); + } /** * Initiate a batch of transactions. It is not guaranteed that the @@ -3089,7 +3374,9 @@ List getValidWriteIds(List tablesList, String validT * optimistically assuming that the result matches the request. * @throws TException */ - OpenTxnsResponse openTxns(String user, int numTxns) throws TException; + default OpenTxnsResponse openTxns(String user, int numTxns) throws TException { + return new OpenTxnsResponse(); + } /** * Rollback a transaction. This will also unlock any locks associated with @@ -3100,7 +3387,7 @@ List getValidWriteIds(List tablesList, String validT * deleted. * @throws TException */ - void rollbackTxn(long txnid) throws NoSuchTxnException, TException; + default void rollbackTxn(long txnid) throws NoSuchTxnException, TException {} /** * Rollback a transaction. This will also unlock any locks associated with @@ -3112,7 +3399,7 @@ List getValidWriteIds(List tablesList, String validT * deleted. * @throws TException */ - void rollbackTxn(AbortTxnRequest abortTxnRequest) throws NoSuchTxnException, TException; + default void rollbackTxn(AbortTxnRequest abortTxnRequest) throws NoSuchTxnException, TException {} /** * Rollback a transaction. This will also unlock any locks associated with @@ -3128,7 +3415,7 @@ List getValidWriteIds(List tablesList, String validT * deleted. * @throws TException */ - void replRollbackTxn(long srcTxnid, String replPolicy, TxnType txnType) throws NoSuchTxnException, TException; + default void replRollbackTxn(long srcTxnid, String replPolicy, TxnType txnType) throws NoSuchTxnException, TException {} /** * Commit a transaction. This will also unlock any locks associated with @@ -3141,8 +3428,8 @@ List getValidWriteIds(List tablesList, String validT * aborted. This can result from the transaction timing out. * @throws TException */ - void commitTxn(long txnid) - throws NoSuchTxnException, TxnAbortedException, TException; + default void commitTxn(long txnid) + throws NoSuchTxnException, TxnAbortedException, TException {} /** * Like commitTxn but it will atomically store as well a key and a value. This @@ -3166,9 +3453,9 @@ void commitTxn(long txnid) * tableId and key are found in TABLE_PARAMS while updating. * @throws TException */ - void commitTxnWithKeyValue(long txnid, long tableId, + default void commitTxnWithKeyValue(long txnid, long tableId, String key, String value) throws NoSuchTxnException, - TxnAbortedException, TException; + TxnAbortedException, TException {} /** * Commit a transaction. This will also unlock any locks associated with @@ -3182,14 +3469,14 @@ void commitTxnWithKeyValue(long txnid, long tableId, * aborted. This can result from the transaction timing out. * @throws TException */ - void commitTxn(CommitTxnRequest rqst) - throws NoSuchTxnException, TxnAbortedException, TException; + default void commitTxn(CommitTxnRequest rqst) + throws NoSuchTxnException, TxnAbortedException, TException {} /** * Abort a list of transactions. This is for use by "ABORT TRANSACTIONS" in the grammar. * @throws TException */ - void abortTxns(List txnids) throws TException; + default void abortTxns(List txnids) throws TException {} /** * Abort a list of transactions with additional information of @@ -3197,7 +3484,7 @@ void commitTxn(CommitTxnRequest rqst) * @param abortTxnsRequest Information containing txnIds and error codes * @throws TException */ - void abortTxns(AbortTxnsRequest abortTxnsRequest) throws TException; + default void abortTxns(AbortTxnsRequest abortTxnsRequest) throws TException {} /** * Allocate a per table write ID and associate it with the given transaction. @@ -3206,7 +3493,9 @@ void commitTxn(CommitTxnRequest rqst) * @param tableName table to which the write ID to be allocated * @throws TException */ - long allocateTableWriteId(long txnId, String dbName, String tableName) throws TException; + default long allocateTableWriteId(long txnId, String dbName, String tableName) throws TException { + return 0; + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3216,7 +3505,9 @@ void commitTxn(CommitTxnRequest rqst) * @param reallocate should we reallocate already mapped writeId (if true) or reuse (if false) * @throws TException */ - long allocateTableWriteId(long txnId, String dbName, String tableName, boolean reallocate) throws TException; + default long allocateTableWriteId(long txnId, String dbName, String tableName, boolean reallocate) throws TException { + return 0; + } /** * Replicate Table Write Ids state to mark aborted write ids and writeid high water mark. @@ -3226,8 +3517,8 @@ void commitTxn(CommitTxnRequest rqst) * @param partNames List of partitions being written. * @throws TException in case of failure to replicate the writeid state */ - void replTableWriteIdState(String validWriteIdList, String dbName, String tableName, List partNames) - throws TException; + default void replTableWriteIdState(String validWriteIdList, String dbName, String tableName, List partNames) + throws TException {} /** * Allocate a per table write ID and associate it with the given transaction. @@ -3236,7 +3527,9 @@ void replTableWriteIdState(String validWriteIdList, String dbName, String tableN * @param tableName table to which the write ID to be allocated * @throws TException */ - List allocateTableWriteIdsBatch(List txnIds, String dbName, String tableName) throws TException; + default List allocateTableWriteIdsBatch(List txnIds, String dbName, String tableName) throws TException { + return Collections.emptyList(); + } /** * Allocate a per table write ID and associate it with the given transaction. Used by replication load task. @@ -3246,8 +3539,10 @@ void replTableWriteIdState(String validWriteIdList, String dbName, String tableN * @param srcTxnToWriteIdList List of txn to write id map sent from the source cluster. * @throws TException */ - List replAllocateTableWriteIdsBatch(String dbName, String tableName, String replPolicy, - List srcTxnToWriteIdList) throws TException; + default List replAllocateTableWriteIdsBatch(String dbName, String tableName, String replPolicy, + List srcTxnToWriteIdList) throws TException { + return Collections.emptyList(); + } /** * Get the maximum allocated writeId for the given table @@ -3256,7 +3551,9 @@ List replAllocateTableWriteIdsBatch(String dbName, String tableNam * @return the maximum allocated writeId * @throws TException */ - long getMaxAllocatedWriteId(String dbName, String tableName) throws TException; + default long getMaxAllocatedWriteId(String dbName, String tableName) throws TException { + return 0; + } /** * Seed an ACID table with the given writeId. If the table already contains writes it will fail. @@ -3265,7 +3562,7 @@ List replAllocateTableWriteIdsBatch(String dbName, String tableNam * @param seedWriteId the start value of writeId * @throws TException */ - void seedWriteId(String dbName, String tableName, long seedWriteId) throws TException; + default void seedWriteId(String dbName, String tableName, long seedWriteId) throws TException {} /** * Seed or increment the global txnId to the given value. @@ -3273,7 +3570,7 @@ List replAllocateTableWriteIdsBatch(String dbName, String tableNam * @param seedTxnId The seed value for the next transactions * @throws TException */ - void seedTxnId(long seedTxnId) throws TException; + default void seedTxnId(long seedTxnId) throws TException {} /** * Show the list of currently open transactions. This is for use by "show transactions" in the @@ -3282,7 +3579,9 @@ List replAllocateTableWriteIdsBatch(String dbName, String tableNam * @return List of currently opened transactions, included aborted ones. * @throws TException */ - GetOpenTxnsInfoResponse showTxns() throws TException; + default GetOpenTxnsInfoResponse showTxns() throws TException { + return new GetOpenTxnsInfoResponse(); + } /** * Request a set of locks. All locks needed for a particular query, DML, @@ -3313,8 +3612,10 @@ List replAllocateTableWriteIdsBatch(String dbName, String tableNam * @throws TException */ @RetrySemantics.CannotRetry - LockResponse lock(LockRequest request) - throws NoSuchTxnException, TxnAbortedException, TException; + default LockResponse lock(LockRequest request) + throws NoSuchTxnException, TxnAbortedException, TException { + return new LockResponse(); + } /** * Check the status of a set of locks requested via a @@ -3337,9 +3638,11 @@ LockResponse lock(LockRequest request) * This can result from the lock timing out and being unlocked by the system. * @throws TException */ - LockResponse checkLock(long lockid) + default LockResponse checkLock(long lockid) throws NoSuchTxnException, TxnAbortedException, NoSuchLockException, - TException; + TException { + return new LockResponse(); + } /** * Unlock a set of locks. This can only be called when the locks are not @@ -3352,8 +3655,8 @@ LockResponse checkLock(long lockid) * transaction. * @throws TException */ - void unlock(long lockid) - throws NoSuchLockException, TxnOpenException, TException; + default void unlock(long lockid) + throws NoSuchLockException, TxnOpenException, TException {} /** * Show all currently held and waiting locks. @@ -3361,7 +3664,9 @@ void unlock(long lockid) * @return List of currently held and waiting locks. * @throws TException */ - ShowLocksResponse showLocks(ShowLocksRequest showLocksRequest) throws TException; + default ShowLocksResponse showLocks(ShowLocksRequest showLocksRequest) throws TException { + return new ShowLocksResponse(); + } /** * Send a heartbeat to indicate that the client holding these locks (if @@ -3383,9 +3688,9 @@ void unlock(long lockid) * This can result from the lock timing out and being unlocked by the system. * @throws TException */ - void heartbeat(long txnid, long lockid) + default void heartbeat(long txnid, long lockid) throws NoSuchLockException, NoSuchTxnException, TxnAbortedException, - TException; + TException {} /** * Send heartbeats for a range of transactions. This is for the streaming ingest client that @@ -3397,7 +3702,9 @@ void heartbeat(long txnid, long lockid) * have already been closed) and which were aborted. * @throws TException */ - HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException; + default HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException { + return new HeartbeatTxnRangeResponse(); + } /** * Send a request to compact a table or partition. This will not block until the compaction is @@ -3409,7 +3716,9 @@ void heartbeat(long txnid, long lockid) * a compaction request. * @throws TException */ - CompactionResponse compact2(CompactionRequest request) throws TException; + default CompactionResponse compact2(CompactionRequest request) throws TException { + return new CompactionResponse(); + } /** * Get a list of all compactions. @@ -3417,12 +3726,16 @@ void heartbeat(long txnid, long lockid) * in progress, and finished but waiting to clean the existing files. * @throws TException */ - ShowCompactResponse showCompactions() throws TException; + default ShowCompactResponse showCompactions() throws TException { + return new ShowCompactResponse(); + } /** * Get a list of compactions for the given request object. */ - ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException; + default ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException { + return new ShowCompactResponse(); + } /** * Submit a request for performing cleanup of output directory. This is particularly @@ -3434,8 +3747,10 @@ void heartbeat(long txnid, long lockid) * @param txnId The transaction ID of the query. * @throws TException */ - boolean submitForCleanup(CompactionRequest rqst, long highestWriteId, - long txnId) throws TException; + default boolean submitForCleanup(CompactionRequest rqst, long highestWriteId, + long txnId) throws TException { + return false; + } /** * Get one latest record of SUCCEEDED or READY_FOR_CLEANING compaction for a table/partition. @@ -3448,8 +3763,10 @@ boolean submitForCleanup(CompactionRequest rqst, long highestWriteId, * partition specified by the request. * @throws TException */ - GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInfo(GetLatestCommittedCompactionInfoRequest request) - throws TException; + default GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInfo(GetLatestCommittedCompactionInfoRequest request) + throws TException { + return new GetLatestCommittedCompactionInfoResponse(); + } /** * Send a list of partitions to the metastore to indicate which partitions were loaded @@ -3461,9 +3778,9 @@ GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInfo(GetLat * @param partNames partition name, as constructed by Warehouse.makePartName * @throws TException */ - void addDynamicPartitions(long txnId, long writeId, String dbName, String tableName, List partNames, + default void addDynamicPartitions(long txnId, long writeId, String dbName, String tableName, List partNames, DataOperationType operationType) - throws TException; + throws TException {} /** * Performs the commit/rollback to the metadata storage for insert operator from external storage handler. @@ -3472,16 +3789,20 @@ void addDynamicPartitions(long txnId, long writeId, String dbName, String tableN * * @throws MetaException */ - void insertTable(Table table, boolean overwrite) throws MetaException; + default void insertTable(Table table, boolean overwrite) throws MetaException {} /** * Checks if there is a conflicting transaction * @param txnId * @return latest txnId in conflict */ - long getLatestTxnIdInConflict(long txnId) throws TException; + default long getLatestTxnIdInConflict(long txnId) throws TException { + return 0; + } - GetDatabaseObjectsResponse get_databases_req(GetDatabaseObjectsRequest request) throws TException; + default GetDatabaseObjectsResponse get_databases_req(GetDatabaseObjectsRequest request) throws TException { + return new GetDatabaseObjectsResponse(); + } /** * A filter provided by the client that determines if a given notification event should be @@ -3510,8 +3831,10 @@ interface NotificationFilter { * @throws TException */ @InterfaceAudience.LimitedPrivate({"HCatalog"}) - NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, - NotificationFilter filter) throws TException; + default NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, + NotificationFilter filter) throws TException { + return new NotificationEventResponse(); + } /** * Get the next set of notifications from the database. @@ -3531,8 +3854,10 @@ NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, * @throws TException */ @InterfaceAudience.LimitedPrivate({"HCatalog"}) - NotificationEventResponse getNextNotification(NotificationEventRequest request, - boolean allowGapsInEventIds, NotificationFilter filter) throws TException; + default NotificationEventResponse getNextNotification(NotificationEventRequest request, + boolean allowGapsInEventIds, NotificationFilter filter) throws TException { + return new NotificationEventResponse(); + } /** * Get the last used notification event id. @@ -3540,7 +3865,9 @@ NotificationEventResponse getNextNotification(NotificationEventRequest request, * @throws TException */ @InterfaceAudience.LimitedPrivate({"HCatalog"}) - CurrentNotificationEventId getCurrentNotificationEventId() throws TException; + default CurrentNotificationEventId getCurrentNotificationEventId() throws TException { + return new CurrentNotificationEventId(); + } /** * Get the number of events from given eventID for the input database. @@ -3548,8 +3875,10 @@ NotificationEventResponse getNextNotification(NotificationEventRequest request, * @throws TException */ @InterfaceAudience.LimitedPrivate({"HCatalog"}) - NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) - throws TException; + default NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) + throws TException { + return new NotificationEventsCountResponse(); + } /** * Request that the metastore fire an event. Currently this is only supported for DML @@ -3560,7 +3889,9 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - FireEventResponse fireListenerEvent(FireEventRequest request) throws TException; + default FireEventResponse fireListenerEvent(FireEventRequest request) throws TException { + return new FireEventResponse(); + } /** * Add a event related to write operations in an ACID table. @@ -3568,7 +3899,7 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - void addWriteNotificationLog(WriteNotificationLogRequest rqst) throws TException; + default void addWriteNotificationLog(WriteNotificationLogRequest rqst) throws TException {} /** * Add a batch of event related to write operations in an ACID table. @@ -3576,7 +3907,7 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - void addWriteNotificationLogInBatch(WriteNotificationLogBatchRequest rqst) throws TException; + default void addWriteNotificationLogInBatch(WriteNotificationLogBatchRequest rqst) throws TException {} class IncompatibleMetastoreException extends MetaException { public IncompatibleMetastoreException(String message) { @@ -3593,8 +3924,11 @@ public IncompatibleMetastoreException(String message) { * @throws MetaException * @throws TException */ - GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRequest getPrincRoleReq) - throws MetaException, TException; + default GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRequest getPrincRoleReq) + throws MetaException, TException { + return new GetPrincipalsInRoleResponse(); + } + /** * get all role-grants for roles that have been granted to given principal @@ -3605,8 +3939,10 @@ GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRequest ge * @throws MetaException * @throws TException */ - GetRoleGrantsForPrincipalResponse get_role_grants_for_principal( - GetRoleGrantsForPrincipalRequest getRolePrincReq) throws MetaException, TException; + default GetRoleGrantsForPrincipalResponse get_role_grants_for_principal( + GetRoleGrantsForPrincipalRequest getRolePrincReq) throws MetaException, TException { + return new GetRoleGrantsForPrincipalResponse(); + } /** * Get aggregated column stats for a set of partitions. @@ -3620,12 +3956,16 @@ GetRoleGrantsForPrincipalResponse get_role_grants_for_principal( * @throws MetaException error accessing the RDBMS * @throws TException thrift transport exception */ - AggrStats getAggrColStatsFor(String dbName, String tblName, - List colNames, List partName, String engine) throws NoSuchObjectException, MetaException, TException; + default AggrStats getAggrColStatsFor(String dbName, String tblName, + List colNames, List partName, String engine) throws NoSuchObjectException, MetaException, TException { + return new AggrStats(); + } - AggrStats getAggrColStatsFor(String dbName, String tblName, + default AggrStats getAggrColStatsFor(String dbName, String tblName, List colNames, List partName, - String engine, String writeIdList) throws NoSuchObjectException, MetaException, TException; + String engine, String writeIdList) throws NoSuchObjectException, MetaException, TException { + return new AggrStats(); + } /** * Get aggregated column stats for a set of partitions. @@ -3640,15 +3980,19 @@ AggrStats getAggrColStatsFor(String dbName, String tblName, * @throws MetaException error accessing the RDBMS * @throws TException thrift transport exception */ - AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, + default AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, List colNames, List partNames, String engine) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return new AggrStats(); + } - AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, + default AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, List colNames, List partNames, String engine, String writeIdList) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + return new AggrStats(); + } /** * Set table or partition column statistics. * @param request request object, contains all the table, partition, and statistics information @@ -3659,38 +4003,48 @@ AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, * @throws TException thrift transport error. * @throws InvalidInputException the input is invalid (eg, a null table name) */ - boolean setPartitionColumnStatistics(SetPartitionsStatsRequest request) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException; + default boolean setPartitionColumnStatistics(SetPartitionsStatsRequest request) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException { + return false; + } /** * Flush any catalog objects held by the metastore implementation. Note that this does not * flush statistics objects. This should be called at the beginning of each query. */ - void flushCache(); + default void flushCache() {} /** * Gets file metadata, as cached by metastore, for respective file IDs. * The metadata that is not cached in metastore may be missing. */ - Iterable> getFileMetadata(List fileIds) throws TException; + default Iterable> getFileMetadata(List fileIds) throws TException { + return Collections.emptyList(); + } - Iterable> getFileMetadataBySarg( - List fileIds, ByteBuffer sarg, boolean doGetFooters) throws TException; + default Iterable> getFileMetadataBySarg( + List fileIds, ByteBuffer sarg, boolean doGetFooters) throws TException { + return Collections.emptyList(); + } /** * Cleares the file metadata cache for respective file IDs. */ - void clearFileMetadata(List fileIds) throws TException; + default void clearFileMetadata(List fileIds) throws TException {} /** * Adds file metadata for respective file IDs to metadata cache in metastore. */ - void putFileMetadata(List fileIds, List metadata) throws TException; + default void putFileMetadata(List fileIds, List metadata) throws TException {} - boolean isSameConfObj(Configuration c); + default boolean isSameConfObj(Configuration c) { + return false; + } - boolean cacheFileMetadata(String dbName, String tableName, String partName, - boolean allParts) throws TException; + default boolean cacheFileMetadata(String dbName, String tableName, String partName, + boolean allParts) throws TException { + return false; + } /** * Get a primary key for a table. @@ -3700,8 +4054,10 @@ boolean cacheFileMetadata(String dbName, String tableName, String partName, * @throws NoSuchObjectException no primary key exists on this table, or maybe no such table * @throws TException thrift transport error */ - List getPrimaryKeys(PrimaryKeysRequest request) - throws MetaException, NoSuchObjectException, TException; + default List getPrimaryKeys(PrimaryKeysRequest request) + throws MetaException, NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get a foreign key for a table. @@ -3711,8 +4067,10 @@ List getPrimaryKeys(PrimaryKeysRequest request) * @throws NoSuchObjectException no foreign key exists on this table, or maybe no such table * @throws TException thrift transport error */ - List getForeignKeys(ForeignKeysRequest request) throws MetaException, - NoSuchObjectException, TException; + default List getForeignKeys(ForeignKeysRequest request) throws MetaException, + NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get a unique constraint for a table. @@ -3722,8 +4080,10 @@ List getForeignKeys(ForeignKeysRequest request) throws MetaExcept * @throws NoSuchObjectException no unique constraint on this table, or maybe no such table * @throws TException thrift transport error */ - List getUniqueConstraints(UniqueConstraintsRequest request) throws MetaException, - NoSuchObjectException, TException; + default List getUniqueConstraints(UniqueConstraintsRequest request) throws MetaException, + NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get a not null constraint for a table. @@ -3733,14 +4093,20 @@ List getUniqueConstraints(UniqueConstraintsRequest request) * @throws NoSuchObjectException no not null constraint on this table, or maybe no such table * @throws TException thrift transport error */ - List getNotNullConstraints(NotNullConstraintsRequest request) throws MetaException, - NoSuchObjectException, TException; + default List getNotNullConstraints(NotNullConstraintsRequest request) throws MetaException, + NoSuchObjectException, TException { + return Collections.emptyList(); + } - List getDefaultConstraints(DefaultConstraintsRequest request) throws MetaException, - NoSuchObjectException, TException; + default List getDefaultConstraints(DefaultConstraintsRequest request) throws MetaException, + NoSuchObjectException, TException { + return Collections.emptyList(); + } - List getCheckConstraints(CheckConstraintsRequest request) throws MetaException, - NoSuchObjectException, TException; + default List getCheckConstraints(CheckConstraintsRequest request) throws MetaException, + NoSuchObjectException, TException { + return Collections.emptyList(); + } /** * Get all constraints of given table @@ -3750,17 +4116,19 @@ List getCheckConstraints(CheckConstraintsRequest request) th * @throws NoSuchObjectException * @throws TException */ - SQLAllTableConstraints getAllTableConstraints(AllTableConstraintsRequest request) - throws MetaException, NoSuchObjectException, TException; + default SQLAllTableConstraints getAllTableConstraints(AllTableConstraintsRequest request) + throws MetaException, NoSuchObjectException, TException { + return new SQLAllTableConstraints(); + } - void createTableWithConstraints( + default void createTableWithConstraints( org.apache.hadoop.hive.metastore.api.Table tTbl, List primaryKeys, List foreignKeys, List uniqueConstraints, List notNullConstraints, List defaultConstraints, List checkConstraints) - throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException; + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {} /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -3772,8 +4140,8 @@ void createTableWithConstraints( * @throws NoSuchObjectException no such constraint exists * @throws TException thrift transport error */ - void dropConstraint(String dbName, String tableName, String constraintName) - throws MetaException, NoSuchObjectException, TException; + default void dropConstraint(String dbName, String tableName, String constraintName) + throws MetaException, NoSuchObjectException, TException {} /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -3786,8 +4154,8 @@ void dropConstraint(String dbName, String tableName, String constraintName) * @throws NoSuchObjectException no such constraint exists * @throws TException thrift transport error */ - void dropConstraint(String catName, String dbName, String tableName, String constraintName) - throws MetaException, NoSuchObjectException, TException; + default void dropConstraint(String catName, String dbName, String tableName, String constraintName) + throws MetaException, NoSuchObjectException, TException {} /** @@ -3797,8 +4165,8 @@ void dropConstraint(String catName, String dbName, String tableName, String cons * @throws NoSuchObjectException no such table exists * @throws TException thrift transport error */ - void addPrimaryKey(List primaryKeyCols) throws - MetaException, NoSuchObjectException, TException; + default void addPrimaryKey(List primaryKeyCols) throws + MetaException, NoSuchObjectException, TException {} /** * Add a foreign key @@ -3807,8 +4175,8 @@ void addPrimaryKey(List primaryKeyCols) throws * @throws NoSuchObjectException one of the tables in the foreign key does not exist. * @throws TException thrift transport error */ - void addForeignKey(List foreignKeyCols) throws - MetaException, NoSuchObjectException, TException; + default void addForeignKey(List foreignKeyCols) throws + MetaException, NoSuchObjectException, TException {} /** * Add a unique constraint @@ -3817,8 +4185,8 @@ void addForeignKey(List foreignKeyCols) throws * @throws NoSuchObjectException no such table * @throws TException thrift transport error */ - void addUniqueConstraint(List uniqueConstraintCols) throws - MetaException, NoSuchObjectException, TException; + default void addUniqueConstraint(List uniqueConstraintCols) throws + MetaException, NoSuchObjectException, TException {} /** * Add a not null constraint @@ -3828,14 +4196,14 @@ void addUniqueConstraint(List uniqueConstraintCols) throws * @throws NoSuchObjectException no such table * @throws TException thrift transport error */ - void addNotNullConstraint(List notNullConstraintCols) throws - MetaException, NoSuchObjectException, TException; + default void addNotNullConstraint(List notNullConstraintCols) throws + MetaException, NoSuchObjectException, TException {} - void addDefaultConstraint(List defaultConstraints) throws - MetaException, NoSuchObjectException, TException; + default void addDefaultConstraint(List defaultConstraints) throws + MetaException, NoSuchObjectException, TException {} - void addCheckConstraint(List checkConstraints) throws - MetaException, NoSuchObjectException, TException; + default void addCheckConstraint(List checkConstraints) throws + MetaException, NoSuchObjectException, TException {} /** * Gets the unique id of the backing database instance used for storing metadata @@ -3843,59 +4211,71 @@ void addCheckConstraint(List checkConstraints) throws * @throws MetaException if HMS is not able to fetch the UUID or if there are multiple UUIDs found in the database * @throws TException in case of Thrift errors */ - String getMetastoreDbUuid() throws MetaException, TException; + default String getMetastoreDbUuid() throws MetaException, TException { + return ""; + } - void createResourcePlan(WMResourcePlan resourcePlan, String copyFromName) - throws InvalidObjectException, MetaException, TException; + default void createResourcePlan(WMResourcePlan resourcePlan, String copyFromName) + throws InvalidObjectException, MetaException, TException {} WMFullResourcePlan getResourcePlan(String resourcePlanName, String ns) throws NoSuchObjectException, MetaException, TException; - List getAllResourcePlans(String ns) - throws NoSuchObjectException, MetaException, TException; + default List getAllResourcePlans(String ns) + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } - void dropResourcePlan(String resourcePlanName, String ns) - throws NoSuchObjectException, MetaException, TException; + default void dropResourcePlan(String resourcePlanName, String ns) + throws NoSuchObjectException, MetaException, TException {} - WMFullResourcePlan alterResourcePlan(String resourcePlanName, String ns, WMNullableResourcePlan resourcePlan, + default WMFullResourcePlan alterResourcePlan(String resourcePlanName, String ns, WMNullableResourcePlan resourcePlan, boolean canActivateDisabled, boolean isForceDeactivate, boolean isReplace) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + return new WMFullResourcePlan(); + } - WMFullResourcePlan getActiveResourcePlan(String ns) throws MetaException, TException; + default WMFullResourcePlan getActiveResourcePlan(String ns) throws MetaException, TException { + return new WMFullResourcePlan(); + } - WMValidateResourcePlanResponse validateResourcePlan(String resourcePlanName, String ns) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default WMValidateResourcePlanResponse validateResourcePlan(String resourcePlanName, String ns) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + return new WMValidateResourcePlanResponse(); + } - void createWMTrigger(WMTrigger trigger) - throws InvalidObjectException, MetaException, TException; + default void createWMTrigger(WMTrigger trigger) + throws InvalidObjectException, MetaException, TException {} - void alterWMTrigger(WMTrigger trigger) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default void alterWMTrigger(WMTrigger trigger) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException {} - void dropWMTrigger(String resourcePlanName, String triggerName, String ns) - throws NoSuchObjectException, MetaException, TException; + default void dropWMTrigger(String resourcePlanName, String triggerName, String ns) + throws NoSuchObjectException, MetaException, TException {} - List getTriggersForResourcePlan(String resourcePlan, String ns) - throws NoSuchObjectException, MetaException, TException; + default List getTriggersForResourcePlan(String resourcePlan, String ns) + throws NoSuchObjectException, MetaException, TException { + return Collections.emptyList(); + } - void createWMPool(WMPool pool) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default void createWMPool(WMPool pool) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException {} - void alterWMPool(WMNullablePool pool, String poolPath) - throws NoSuchObjectException, InvalidObjectException, TException; + default void alterWMPool(WMNullablePool pool, String poolPath) + throws NoSuchObjectException, InvalidObjectException, TException {} - void dropWMPool(String resourcePlanName, String poolPath, String ns) - throws TException; + default void dropWMPool(String resourcePlanName, String poolPath, String ns) + throws TException {} - void createOrUpdateWMMapping(WMMapping mapping, boolean isUpdate) - throws TException; + default void createOrUpdateWMMapping(WMMapping mapping, boolean isUpdate) + throws TException {} - void dropWMMapping(WMMapping mapping) - throws TException; + default void dropWMMapping(WMMapping mapping) + throws TException {} - void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerName, + default void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerName, String poolPath, boolean shouldDrop, String ns) throws AlreadyExistsException, NoSuchObjectException, - InvalidObjectException, MetaException, TException; + InvalidObjectException, MetaException, TException {} /** * Create a new schema. This is really a schema container, as there will be specific versions @@ -3906,7 +4286,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void createISchema(ISchema schema) throws TException; + default void createISchema(ISchema schema) throws TException {} /** * Alter an existing schema. @@ -3918,7 +4298,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void alterISchema(String catName, String dbName, String schemaName, ISchema newSchema) throws TException; + default void alterISchema(String catName, String dbName, String schemaName, ISchema newSchema) throws TException {} /** * Fetch a schema. @@ -3930,7 +4310,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - ISchema getISchema(String catName, String dbName, String name) throws TException; + default ISchema getISchema(String catName, String dbName, String name) throws TException { + return new ISchema(); + } /** * Drop an existing schema. If there are schema versions of this, this call will fail. @@ -3942,7 +4324,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void dropISchema(String catName, String dbName, String name) throws TException; + default void dropISchema(String catName, String dbName, String name) throws TException {} /** * Add a new version to an existing schema. @@ -3952,7 +4334,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void addSchemaVersion(SchemaVersion schemaVersion) throws TException; + default void addSchemaVersion(SchemaVersion schemaVersion) throws TException {} /** * Get a specific version of a schema. @@ -3964,7 +4346,10 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - SchemaVersion getSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException; + default SchemaVersion getSchemaVersion(String catName, String dbName, String schemaName, int version) + throws TException { + return new SchemaVersion(); + } /** * Get the latest version of a schema. @@ -3977,7 +4362,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - SchemaVersion getSchemaLatestVersion(String catName, String dbName, String schemaName) throws TException; + default SchemaVersion getSchemaLatestVersion(String catName, String dbName, String schemaName) throws TException { + return new SchemaVersion(); + } /** * Get all the extant versions of a schema. @@ -3990,7 +4377,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - List getSchemaAllVersions(String catName, String dbName, String schemaName) throws TException; + default List getSchemaAllVersions(String catName, String dbName, String schemaName) throws TException { + return Collections.emptyList(); + } /** * Drop a version of a schema. Given that versions are supposed to be immutable you should @@ -4004,7 +4393,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void dropSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException; + default void dropSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException {} /** * Find all schema versions that have columns that match a query. @@ -4014,7 +4403,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - FindSchemasByColsResp getSchemaByCols(FindSchemasByColsRqst rqst) throws TException; + default FindSchemasByColsResp getSchemaByCols(FindSchemasByColsRqst rqst) throws TException { + return new FindSchemasByColsResp(); + } /** * Map a schema version to a serde. This mapping is one-to-one, thus this will destroy any @@ -4029,7 +4420,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void mapSchemaVersionToSerde(String catName, String dbName, String schemaName, int version, String serdeName) throws TException; + default void mapSchemaVersionToSerde(String catName, String dbName, String schemaName, int version, String serdeName) throws TException {} /** * Set the state of a schema version. @@ -4043,7 +4434,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void setSchemaVersionState(String catName, String dbName, String schemaName, int version, SchemaVersionState state) throws TException; + default void setSchemaVersionState(String catName, String dbName, String schemaName, int version, SchemaVersionState state) throws TException {} /** * Add a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4053,7 +4444,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - void addSerDe(SerDeInfo serDeInfo) throws TException; + default void addSerDe(SerDeInfo serDeInfo) throws TException {} /** * Fetch a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4064,7 +4455,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException general metastore error * @throws TException general thrift error */ - SerDeInfo getSerDe(String serDeName) throws TException; + default SerDeInfo getSerDe(String serDeName) throws TException { + return new SerDeInfo(); + } /** * Acquire the materialization rebuild lock for a given view. We need to specify the fully @@ -4076,7 +4469,10 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @return the response from the metastore, where the lock id is equal to the txn id and * the status can be either ACQUIRED or NOT ACQUIRED */ - LockResponse lockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException; + default LockResponse lockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException { + return new LockResponse(); + } + /** * Method to refresh the acquisition of a given materialization rebuild lock. @@ -4085,13 +4481,17 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @param txnId transaction id for the rebuild * @return true if the lock could be renewed, false otherwise */ - boolean heartbeatLockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException; + default boolean heartbeatLockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException { + return false; + } /** Adds a RuntimeStat for metastore persistence. */ - void addRuntimeStat(RuntimeStat stat) throws TException; + default void addRuntimeStat(RuntimeStat stat) throws TException {} /** Reads runtime statistics. */ - List getRuntimeStats(int maxWeight, int maxCreateTime) throws TException; + default List getRuntimeStats(int maxWeight, int maxCreateTime) throws TException { + return Collections.emptyList(); + } /** * Generic Partition request API, providing different ways of filtering and controlling output. @@ -4109,7 +4509,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * Partition filter spec is the generalization of various types of partition filtering. * Partitions can be filtered by names, by values or by partition expressions. */ - GetPartitionsResponse getPartitionsWithSpecs(GetPartitionsRequest request) throws TException; + default GetPartitionsResponse getPartitionsWithSpecs(GetPartitionsRequest request) throws TException { + return new GetPartitionsResponse(); + } /** * Get the next compaction job to do. @@ -4118,7 +4520,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - OptionalCompactionInfoStruct findNextCompact(FindNextCompactRequest rqst) throws MetaException, TException; + default OptionalCompactionInfoStruct findNextCompact(FindNextCompactRequest rqst) throws MetaException, TException { + return new OptionalCompactionInfoStruct(); + } /** * Set the compaction highest write id. @@ -4126,7 +4530,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @param txnId transaction id. * @throws TException */ - void updateCompactorState(CompactionInfoStruct cr, long txnId) throws TException; + default void updateCompactorState(CompactionInfoStruct cr, long txnId) throws TException {} /** * Get columns. @@ -4134,7 +4538,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @return * @throws TException */ - List findColumnsWithStats(CompactionInfoStruct cr) throws TException; + default List findColumnsWithStats(CompactionInfoStruct cr) throws TException { + return Collections.emptyList(); + } /** * Mark a finished compaction as cleaned. @@ -4142,7 +4548,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void markCleaned(CompactionInfoStruct cr) throws MetaException, TException; + default void markCleaned(CompactionInfoStruct cr) throws MetaException, TException {} /** * Mark a finished compaction as compacted. @@ -4150,7 +4556,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void markCompacted(CompactionInfoStruct cr) throws MetaException, TException; + default void markCompacted(CompactionInfoStruct cr) throws MetaException, TException {} /** * Mark a finished compaction as failed. @@ -4158,7 +4564,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void markFailed(CompactionInfoStruct cr) throws MetaException, TException; + default void markFailed(CompactionInfoStruct cr) throws MetaException, TException {} /** * Mark a compaction as refused (to run). @@ -4166,7 +4572,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void markRefused(CompactionInfoStruct cr) throws MetaException, TException; + default void markRefused(CompactionInfoStruct cr) throws MetaException, TException {} /** * Create, update or delete one record in the compaction metrics cache. @@ -4194,7 +4600,7 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void removeCompactionMetricsData(CompactionMetricsDataRequest request) throws MetaException, TException; + default void removeCompactionMetricsData(CompactionMetricsDataRequest request) throws MetaException, TException {} /** * Set the hadoop id for a compaction. * @param jobId mapreduce job id that will do the compaction. @@ -4202,72 +4608,92 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @throws MetaException * @throws TException */ - void setHadoopJobid(String jobId, long cqId) throws MetaException, TException; + default void setHadoopJobid(String jobId, long cqId) throws MetaException, TException {} /** * Gets the version string of the metastore server which this client is connected to * * @return String representation of the version number of Metastore server (eg: 3.1.0-SNAPSHOT) */ - String getServerVersion() throws TException; + default String getServerVersion() throws TException { + return ""; + } /** * Returns details about a scheduled query by name. * * @throws NoSuchObjectException if an object by the given name dosen't exists. */ - ScheduledQuery getScheduledQuery(ScheduledQueryKey scheduleKey) throws TException; + default ScheduledQuery getScheduledQuery(ScheduledQueryKey scheduleKey) throws TException { + return new ScheduledQuery(); + } /** * Carries out maintenance of scheduled queries (insert/update/drop). */ - void scheduledQueryMaintenance(ScheduledQueryMaintenanceRequest request) throws MetaException, TException; + default void scheduledQueryMaintenance(ScheduledQueryMaintenanceRequest request) throws MetaException, TException {} /** * Checks whenever a query is available for execution. * * @return optionally a scheduled query to be processed. */ - ScheduledQueryPollResponse scheduledQueryPoll(ScheduledQueryPollRequest request) throws MetaException, TException; + default ScheduledQueryPollResponse scheduledQueryPoll(ScheduledQueryPollRequest request) throws MetaException, TException { + return new ScheduledQueryPollResponse(); + } /** * Registers the progress a scheduled query being executed. */ - void scheduledQueryProgress(ScheduledQueryProgressInfo info) throws TException; + default void scheduledQueryProgress(ScheduledQueryProgressInfo info) throws TException {} /** * Adds replication metrics for the replication policies. * @param replicationMetricList * @throws MetaException */ - void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException; + default void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException {} - ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest - replicationMetricsRequest) throws MetaException, TException; + default ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest + replicationMetricsRequest) throws MetaException, TException { + return new ReplicationMetricList(); + } - void createStoredProcedure(StoredProcedure proc) throws NoSuchObjectException, MetaException, TException; + default void createStoredProcedure(StoredProcedure proc) throws NoSuchObjectException, MetaException, TException {} - StoredProcedure getStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException; + default StoredProcedure getStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException { + return new StoredProcedure(); + } - void dropStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException; + default void dropStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException {} - List getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException; + default List getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException { + return Collections.emptyList(); + } - void addPackage(AddPackageRequest request) throws NoSuchObjectException, MetaException, TException; + default void addPackage(AddPackageRequest request) throws NoSuchObjectException, MetaException, TException {} - Package findPackage(GetPackageRequest request) throws TException; + default Package findPackage(GetPackageRequest request) throws TException { + return new Package(); + } - List listPackages(ListPackageRequest request) throws TException; + default List listPackages(ListPackageRequest request) throws TException { + return Collections.emptyList(); + } - void dropPackage(DropPackageRequest request) throws TException; + default void dropPackage(DropPackageRequest request) throws TException {} /** * Get acid write events of a specific transaction. * @throws TException */ - List getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException; + default List getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException { + return Collections.emptyList(); + } - AbortCompactResponse abortCompactions(AbortCompactionRequest request) throws TException; + default AbortCompactResponse abortCompactions(AbortCompactionRequest request) throws TException { + return new AbortCompactResponse(); + } /** * Sets properties. diff --git a/standalone-metastore/pom.xml b/standalone-metastore/pom.xml index 7cdd8f5b31f5..957330ad52e9 100644 --- a/standalone-metastore/pom.xml +++ b/standalone-metastore/pom.xml @@ -113,6 +113,8 @@ 1.7.30 4.4.13 4.5.13 + 5.3 + 5.3 4.5.8 9.37.3 9.4.57.v20241219 From abe559eaa746318b2cd3da852b951a1e83683e7d Mon Sep 17 00:00:00 2001 From: Zoltan Ratkai Date: Mon, 7 Jul 2025 09:14:01 +0200 Subject: [PATCH 2/3] HIVE-28658 review comment fixes Change-Id: I3aa2bd6571aa8fe6b314ac097483c0ed9ae30198 --- README.md | 26 +- .../HiveIcebergRESTCatalogClientAdapter.java | 28 +- ...stHiveIcebergRESTCatalogClientAdapter.java | 5 +- .../java/org/apache/iceberg/mr/Catalogs.java | 12 +- .../apache/iceberg/mr/InputFormatConfig.java | 15 +- .../ql/metadata/IMetaStoreClientFactory.java | 8 +- .../hive/metastore/IMetaStoreClient.java | 890 +++++++++++------- 7 files changed, 596 insertions(+), 388 deletions(-) diff --git a/README.md b/README.md index f75d9a257174..93c6c3e46289 100644 --- a/README.md +++ b/README.md @@ -114,46 +114,42 @@ Using Iceberg REST catalog To enable Apache Iceberg REST catalog usage add the followings in hive-site.xml - iceberg.catalog - rest + connector.name + iceberg - iceberg.catalog.rest.type + + iceberg.rest-catalog.type rest - iceberg.catalog.rest.uri + iceberg.rest-catalog.uri {restServerUrl} - - metastore.type - rest - - For OAUTH2 authentication add this as well: - iceberg.catalog.rest.security + iceberg.rest-catalog.security OAUTH2 - iceberg.catalog.rest.credential + iceberg.rest-catalog.credential {user:pass} - iceberg.catalog.rest.scope + iceberg.rest-catalog.scope PRINCIPAL_ROLE:ALL - iceberg.catalog.rest.oauth2.credential + iceberg.rest-catalog.oauth2.credential {user:pass} - iceberg.catalog.rest.oauth2.scope + iceberg.rest-catalog.oauth2.scope PRINCIPAL_ROLE:ALL - iceberg.catalog.rest.warehouse + iceberg.rest-catalog.warehouse {catalogName} diff --git a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java index 6737fe5e34b3..801adc253bdf 100644 --- a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java @@ -61,7 +61,6 @@ import org.apache.iceberg.SortOrder; import org.apache.iceberg.TableMetadata; import org.apache.iceberg.catalog.Namespace; -import org.apache.iceberg.catalog.SessionCatalog; import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.exceptions.NoSuchTableException; import org.apache.iceberg.relocated.com.google.common.collect.Lists; @@ -77,14 +76,15 @@ public class HiveIcebergRESTCatalogClientAdapter implements IMetaStoreClient { public static final String NAMESPACE_SEPARATOR = "."; public static final String NAME = "name"; public static final String LOCATION = "location"; - public static final String CATALOG_NAME = "iceberg.catalog"; + public static final String ICEBERG_CATALOG_TYPE = "iceberg.catalog.default_iceberg.type"; public static final String DB_OWNER = "owner"; public static final String DB_OWNER_TYPE = "ownerType"; public static final String DEFAULT_INPUT_FORMAT_CLASS = "org.apache.iceberg.mr.hive.HiveIcebergInputFormat"; public static final String DEFAULT_OUTPUT_FORMAT_CLASS = "org.apache.iceberg.mr.hive.HiveIcebergOutputFormat"; public static final String DEFAULT_SERDE_CLASS = "org.apache.iceberg.mr.hive.HiveIcebergSerDe"; - public static final String CATALOG_CONFIG_PREFIX = "iceberg.catalog."; + public static final String CATALOG_CONFIG_PREFIX = "iceberg.rest-catalog."; + public static final String WAREHOUSE = "warehouse"; private final Configuration conf; private RESTCatalog restCatalog; private final HiveMetaHookLoader hookLoader; @@ -99,31 +99,31 @@ public HiveIcebergRESTCatalogClientAdapter(Configuration conf, HiveMetaHookLoade } @Override - public void reconnect() throws MetaException { - SessionCatalog.SessionContext context = SessionCatalog.SessionContext.createEmpty(); - String catalogName = conf.get(CATALOG_NAME); - Map properties = getCatalogPropertiesFromConf(conf, catalogName); - restCatalog = (RESTCatalog) CatalogUtil.buildIcebergCatalog(catalogName, properties, conf); + public void reconnect() { + Map properties = getCatalogPropertiesFromConf(conf); + String catalogName = properties.get(WAREHOUSE); + restCatalog = new RESTCatalog(); restCatalog.initialize(catalogName, properties); } @Override public void close() { try { - restCatalog.close(); + if (restCatalog != null) { + restCatalog.close(); + } } catch (IOException e) { throw new RuntimeException(e); } } private static Map getCatalogPropertiesFromConf( - Configuration conf, String catalogName) { + Configuration conf) { Map catalogProperties = Maps.newHashMap(); - String keyPrefix = CATALOG_CONFIG_PREFIX + catalogName; conf.forEach(config -> { - if (config.getKey().startsWith(keyPrefix)) { + if (config.getKey().startsWith(CATALOG_CONFIG_PREFIX)) { catalogProperties.put( - config.getKey().substring(keyPrefix.length() + 1), + config.getKey().substring(CATALOG_CONFIG_PREFIX.length()), config.getValue()); } }); @@ -273,7 +273,7 @@ private Table convertIcebergTableToHiveTable(org.apache.iceberg.Table icebergTab TableMetadata metadata = ((BaseTable) icebergTable).operations().current(); HMSTablePropertyHelper.updateHmsTableForIcebergTable(metadata.metadataFileLocation(), hiveTable, metadata, null, true, maxHiveTablePropertySize, null); - hiveTable.getParameters().put(CATALOG_NAME, CatalogUtil.ICEBERG_CATALOG_TYPE_REST); + hiveTable.getParameters().put(ICEBERG_CATALOG_TYPE, CatalogUtil.ICEBERG_CATALOG_TYPE_REST); hiveTable.setTableName(getTableName(icebergTable)); hiveTable.setDbName(getDbName(icebergTable)); StorageDescriptor storageDescriptor = new StorageDescriptor(); diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java index 1ff842ea0424..2224fe7c741a 100644 --- a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java +++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java @@ -62,9 +62,8 @@ public class TestHiveIcebergRESTCatalogClientAdapter { @BeforeAll public static void before() throws MetaException { Configuration configuration = new Configuration(); - configuration.set("iceberg.catalog", "rest"); - configuration.set("iceberg.catalog.rest.type", "rest"); - configuration.set("iceberg.catalog.rest.uri", "http://localhost"); + configuration.set("iceberg.catalog.type", "rest"); + configuration.set("iceberg.rest-catalog.uri", "http://localhost"); catalogUtilMockedStatic = Mockito.mockStatic(CatalogUtil.class); restCatalog = Mockito.mock(RESTCatalog.class); catalogUtilMockedStatic.when(() -> CatalogUtil.buildIcebergCatalog(any(), any(), any())).thenReturn(restCatalog); diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java index b797d7aa9763..868bb783441a 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java @@ -71,6 +71,8 @@ public final class Catalogs { public static final String SNAPSHOT_REF = "snapshot_ref"; private static final String NO_CATALOG_TYPE = "no catalog"; + private static final String REST_CATALOG_TYPE = "rest"; + private static final Set PROPERTIES_TO_REMOVE = ImmutableSet.of(InputFormatConfig.TABLE_SCHEMA, InputFormatConfig.PARTITION_SPEC, LOCATION, NAME, InputFormatConfig.CATALOG_NAME); @@ -255,7 +257,8 @@ static Optional loadCatalog(Configuration conf, String catalogName) { */ private static Map getCatalogProperties(Configuration conf, String catalogName) { Map catalogProperties = Maps.newHashMap(); - String keyPrefix = InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName; + String keyPrefix = REST_CATALOG_TYPE.equals(catalogType) ? + InputFormatConfig.CATALOG_REST_CONFIG_PREFIX : InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName; conf.forEach(config -> { if (config.getKey().startsWith(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX)) { catalogProperties.putIfAbsent( @@ -267,7 +270,9 @@ private static Map getCatalogProperties(Configuration conf, Stri config.getValue()); } }); - + if (REST_CATALOG_TYPE.equals(catalogType)) { + catalogProperties.put("type", "rest"); + } return catalogProperties; } @@ -290,7 +295,8 @@ private static String getCatalogType(Configuration conf, String catalogName) { return catalogType; } } else { - String catalogType = conf.get(CatalogUtil.ICEBERG_CATALOG_TYPE); + String catalogType = conf.get(InputFormatConfig.catalogPropertyConfigKey( + "", CatalogUtil.ICEBERG_CATALOG_TYPE)); if (catalogType != null && catalogType.equals(LOCATION)) { return NO_CATALOG_TYPE; } else { diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java index 4898b4b8954f..d26bdef45588 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java @@ -28,6 +28,7 @@ import org.apache.iceberg.catalog.TableIdentifier; import org.apache.iceberg.expressions.Expression; import org.apache.iceberg.util.SerializationUtil; +import org.apache.parquet.Strings; public class InputFormatConfig { @@ -69,23 +70,15 @@ private InputFormatConfig() { public static final int COMMIT_TABLE_THREAD_POOL_SIZE_DEFAULT = 10; public static final String COMMIT_FILE_THREAD_POOL_SIZE = "iceberg.mr.commit.file.thread.pool.size"; public static final int COMMIT_FILE_THREAD_POOL_SIZE_DEFAULT = 10; - public static final String WRITE_TARGET_FILE_SIZE = "iceberg.mr.write.target.file.size"; public static final String CASE_SENSITIVE = "iceberg.mr.case.sensitive"; public static final boolean CASE_SENSITIVE_DEFAULT = true; public static final String CATALOG_NAME = "iceberg.catalog"; - public static final String HADOOP_CATALOG = "hadoop.catalog"; - public static final String HADOOP_TABLES = "hadoop.tables"; public static final String HIVE_CATALOG = "hive.catalog"; - public static final String ICEBERG_SNAPSHOTS_TABLE_SUFFIX = ".snapshots"; - public static final String SNAPSHOT_TABLE = "iceberg.snapshots.table"; - public static final String SNAPSHOT_TABLE_SUFFIX = "__snapshots"; public static final String CATALOG_CONFIG_PREFIX = "iceberg.catalog."; - public static final String CATALOG_TYPE_TEMPLATE = "iceberg.catalog.%s.type"; - public static final String CATALOG_WAREHOUSE_TEMPLATE = "iceberg.catalog.%s.warehouse"; - public static final String CATALOG_CLASS_TEMPLATE = "iceberg.catalog.%s.catalog-impl"; + public static final String CATALOG_REST_CONFIG_PREFIX = "iceberg.rest-catalog"; public static final String CATALOG_DEFAULT_CONFIG_PREFIX = "iceberg.catalog-default."; public enum InMemoryDataModel { @@ -224,7 +217,9 @@ public static boolean fetchVirtualColumns(Configuration conf) { * @return Hadoop config key of a catalog property for the catalog name */ public static String catalogPropertyConfigKey(String catalogName, String catalogProperty) { - return String.format("%s%s.%s", CATALOG_CONFIG_PREFIX, catalogName, catalogProperty); + return Strings.isNullOrEmpty(catalogName) ? + String.format("%s%s", CATALOG_CONFIG_PREFIX, catalogProperty) : + String.format("%s%s.%s", CATALOG_CONFIG_PREFIX, catalogName, catalogProperty); } private static Schema schema(Configuration conf, String key) { diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java index 054580681645..87dad1bf5202 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java @@ -34,13 +34,13 @@ public class IMetaStoreClientFactory { - public static final String REST_METASTORE_TYPE = "rest"; + public static final String CONNECTOR_NAME = "iceberg"; public static IMetaStoreClient create(HiveConf hiveConf, boolean allowEmbedded, ConcurrentHashMap metaCallTimeMap, HiveMetaHookLoader hookLoader) throws MetaException { - if (REST_METASTORE_TYPE.equals(hiveConf.get("metastore.type", "hms"))) { - return getHiveIcebergRESTCatalog(hiveConf, hookLoader); + if (CONNECTOR_NAME.equals(hiveConf.get("connector.name", "hms"))) { + return getHiveIcebergRESTCatalogClient(hiveConf, hookLoader); } IMetaStoreClient thriftClient = ThriftHiveMetaStoreClient.newClient(hiveConf, allowEmbedded); IMetaStoreClient clientWithLocalCache = HiveMetaStoreClientWithLocalCache.newClient(hiveConf, thriftClient); @@ -59,7 +59,7 @@ public static IMetaStoreClient create(HiveConf hiveConf, boolean allowEmbedded, ); } } - private static IMetaStoreClient getHiveIcebergRESTCatalog(HiveConf conf, HiveMetaHookLoader hookLoader) throws + private static IMetaStoreClient getHiveIcebergRESTCatalogClient(HiveConf conf, HiveMetaHookLoader hookLoader) throws MetaException { try { Class handlerClass = diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index bfe581491c7f..21e5bc2d390b 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -62,7 +62,9 @@ default boolean isCompatibleWith(Configuration configuration) { * Set added jars path info to MetaStoreClient. * @param addedJars the hive.added.jars.path. It is qualified paths separated by commas. */ - default void setHiveAddedJars(String addedJars){}; + default void setHiveAddedJars(String addedJars) { + throw new UnsupportedOperationException("this method is not supported"); + }; /** * Returns true if the current client is using an in process metastore (local metastore). @@ -70,7 +72,7 @@ default boolean isCompatibleWith(Configuration configuration) { * @return */ default boolean isLocalMetaStore(){ - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -87,7 +89,9 @@ default boolean isLocalMetaStore(){ /** * set meta variable which is open to end users */ - default void setMetaConf(String key, String value) throws MetaException, TException {} + default void setMetaConf(String key, String value) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * get current meta variable @@ -106,7 +110,8 @@ default String getMetaConf(String key) throws MetaException, TException{ * @throws TException general thrift exception. */ default void createCatalog(Catalog catalog) - throws AlreadyExistsException, InvalidObjectException, MetaException, TException{ + throws AlreadyExistsException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -122,7 +127,8 @@ default void createCatalog(Catalog catalog) * @throws TException general thrift exception */ default void alterCatalog(String catalogName, Catalog newCatalog) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException{ + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -133,8 +139,8 @@ default void alterCatalog(String catalogName, Catalog newCatalog) * @throws MetaException something went wrong, usually in the database. * @throws TException general thrift exception. */ - default Catalog getCatalog(String catName) throws NoSuchObjectException, MetaException, TException{ - return null; + default Catalog getCatalog(String catName) throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -143,8 +149,8 @@ default Catalog getCatalog(String catName) throws NoSuchObjectException, MetaExc * @throws MetaException something went wrong, usually in the database. * @throws TException general thrift exception. */ - default List getCatalogs() throws MetaException, TException{ - return new LinkedList<>(); + default List getCatalogs() throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -158,6 +164,7 @@ default List getCatalogs() throws MetaException, TException{ */ default void dropCatalog(String catName) throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -168,6 +175,7 @@ default void dropCatalog(String catName) * @throws TException general thrift exception. */ default void dropCatalog(String catName, boolean ifExists) throws TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -272,8 +280,8 @@ List getTables(String catName, String dbName, String tablePattern, Table * @throws UnknownDBException no such database */ default List
getAllMaterializedViewObjectsForRewriting() - throws MetaException, TException, UnknownDBException{ - return Collections.emptyList(); + throws MetaException, TException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -288,8 +296,8 @@ default List
getAllMaterializedViewObjectsForRewriting() * @throws TException Thrown if there is a thrift transport exception. */ default List getTablesExt(String catName, String dbName, String tablePattern, int requestedFields, - int limit) throws MetaException, TException{ - return Collections.emptyList(); + int limit) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -301,8 +309,8 @@ default List getTablesExt(String catName, String dbName, Stri * @throws UnknownDBException no such database */ default List getMaterializedViewsForRewriting(String dbName) - throws MetaException, TException, UnknownDBException{ - return Collections.emptyList(); + throws MetaException, TException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -315,8 +323,8 @@ default List getMaterializedViewsForRewriting(String dbName) * @throws UnknownDBException no such database */ default List getMaterializedViewsForRewriting(String catName, String dbName) - throws MetaException, TException, UnknownDBException{ - return Collections.emptyList(); + throws MetaException, TException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -332,8 +340,8 @@ default List getMaterializedViewsForRewriting(String catName, String dbN * @throws UnknownDBException No databases match the provided pattern. */ default List getTableMeta(String dbPatterns, String tablePatterns, List tableTypes) - throws MetaException, TException, UnknownDBException{ - return Collections.emptyList(); + throws MetaException, TException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -351,8 +359,8 @@ default List getTableMeta(String dbPatterns, String tablePatterns, Li */ default List getTableMeta(String catName, String dbPatterns, String tablePatterns, List tableTypes) - throws MetaException, TException, UnknownDBException{ - return Collections.emptyList(); + throws MetaException, TException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -417,8 +425,8 @@ List getAllTables(String catName, String dbName) * @throws TException thrift transport error */ default List listTableNamesByFilter(String dbName, String filter, short maxTables) - throws TException, InvalidOperationException, UnknownDBException{ - return Collections.emptyList(); + throws TException, InvalidOperationException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -462,8 +470,8 @@ default List listTableNamesByFilter(String dbName, String filter, short * @throws TException thrift transport error */ default List listTableNamesByFilter(String catName, String dbName, String filter, int maxTables) - throws TException, InvalidOperationException, UnknownDBException{ - return Collections.emptyList(); + throws TException, InvalidOperationException, UnknownDBException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -600,19 +608,29 @@ default void dropTable(String catName, String dbName, String tableName) * @throws TException Thrift transport exception */ @Deprecated - default void truncateTable(String dbName, String tableName, List partNames) throws MetaException, TException{} + default void truncateTable(String dbName, String tableName, List partNames) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - default void truncateTable(TableName table, List partNames) throws TException{} + default void truncateTable(TableName table, List partNames) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void truncateTable(String dbName, String tableName, List partNames, - String validWriteIds, long writeId) throws TException{} + String validWriteIds, long writeId) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void truncateTable(String dbName, String tableName, List partNames, - String validWriteIds, long writeId, boolean deleteData) throws TException {}; + String validWriteIds, long writeId, boolean deleteData) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + }; default void truncateTable(String catName, String dbName, String tableName, String ref, List partNames, - String validWriteIds, long writeId, boolean deleteData, EnvironmentContext context) throws TException {}; + String validWriteIds, long writeId, boolean deleteData, EnvironmentContext context) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + }; /** * Recycles the files recursively from the input path to the cmroot directory either by copying or moving it. @@ -621,8 +639,8 @@ default void truncateTable(String catName, String dbName, String tableName, Stri * isPurge flag when set to true files which needs to be recycled are not moved to Trash * @return Response which is currently void */ - default CmRecycleResponse recycleDirToCmPath(CmRecycleRequest request) throws MetaException, TException{ - return new CmRecycleResponse(); + default CmRecycleResponse recycleDirToCmPath(CmRecycleRequest request) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -780,8 +798,8 @@ Table getTable(String catName, String dbName, String tableName, * Any other errors */ default List
getTableObjectsByName(String dbName, List tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException{ - return Collections.emptyList(); + throws MetaException, InvalidOperationException, UnknownDBException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -805,8 +823,8 @@ default List
getTableObjectsByName(String dbName, List tableNames * Any other errors */ default List
getTables(String catName, String dbName, List tableNames, GetProjectionsSpec projectionsSpec) - throws MetaException, InvalidOperationException, UnknownDBException, TException{ - return Collections.emptyList(); + throws MetaException, InvalidOperationException, UnknownDBException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** * Get tables as objects (rather than just fetching their names). This is more expensive and @@ -830,29 +848,33 @@ default List
getTables(String catName, String dbName, List tableN * Any other errors */ default List
getTableObjectsByName(String catName, String dbName, List tableNames) - throws MetaException, InvalidOperationException, UnknownDBException, TException{ - return Collections.emptyList(); + throws MetaException, InvalidOperationException, UnknownDBException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** * Returns the invalidation information for the materialized views given as input. */ default Materialization getMaterializationInvalidationInfo(CreationMetadata cm, String validTxnList) - throws MetaException, InvalidOperationException, UnknownDBException, TException{ - return new Materialization(); + throws MetaException, InvalidOperationException, UnknownDBException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** * Updates the creation metadata for the materialized view. */ default void updateCreationMetadata(String dbName, String tableName, CreationMetadata cm) - throws MetaException, TException{} + throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Updates the creation metadata for the materialized view. */ default void updateCreationMetadata(String catName, String dbName, String tableName, CreationMetadata cm) - throws MetaException, TException{} + throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** /** @@ -868,8 +890,8 @@ default void updateCreationMetadata(String catName, String dbName, String tableN * @throws TException thrift transport error */ default Partition appendPartition(String dbName, String tableName, List partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return new Partition(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -886,8 +908,8 @@ default Partition appendPartition(String dbName, String tableName, List * @throws TException thrift transport error */ default Partition appendPartition(String catName, String dbName, String tableName, List partVals) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return new Partition(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -903,8 +925,8 @@ default Partition appendPartition(String catName, String dbName, String tableNam * @throws TException thrift transport error */ default Partition appendPartition(String dbName, String tableName, String name) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return new Partition(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -921,8 +943,8 @@ default Partition appendPartition(String dbName, String tableName, String name) * @throws TException thrift transport error */ default Partition appendPartition(String catName, String dbName, String tableName, String name) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return new Partition(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -941,8 +963,8 @@ default Partition appendPartition(String catName, String dbName, String tableNam * Thrift exception */ default Partition add_partition(Partition partition) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return new Partition(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -960,8 +982,8 @@ default Partition add_partition(Partition partition) * Thrift exception */ default int add_partitions(List partitions) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return 0; + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -974,8 +996,8 @@ default int add_partitions(List partitions) * @throws TException thrift transport error */ default int add_partitions_pspec(PartitionSpecProxy partitionSpec) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return 0; + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -988,8 +1010,8 @@ default int add_partitions_pspec(PartitionSpecProxy partitionSpec) */ default List add_partitions( List partitions, boolean ifNotExists, boolean needResults) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException{ - return Collections.emptyList(); + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1004,8 +1026,8 @@ default List add_partitions( * @throws TException thrift transport error */ default Partition getPartition(String dbName, String tblName, List partVals) - throws NoSuchObjectException, MetaException, TException{ - return new Partition(); + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1017,8 +1039,8 @@ default Partition getPartition(String dbName, String tblName, List partV * @throws TException thrift transport error */ default GetPartitionResponse getPartitionRequest(GetPartitionRequest req) - throws NoSuchObjectException, MetaException, TException{ - return new GetPartitionResponse(); + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1034,8 +1056,8 @@ default GetPartitionResponse getPartitionRequest(GetPartitionRequest req) * @throws TException thrift transport error */ default Partition getPartition(String catName, String dbName, String tblName, List partVals) - throws NoSuchObjectException, MetaException, TException{ - return new Partition(); + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1054,8 +1076,8 @@ default Partition getPartition(String catName, String dbName, String tblName, Li default Partition exchange_partition(Map partitionSpecs, String sourceDb, String sourceTable, String destdb, String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException{ - return new Partition(); + InvalidObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1076,8 +1098,8 @@ default Partition exchange_partition(Map partitionSpecs, default Partition exchange_partition(Map partitionSpecs, String sourceCat, String sourceDb, String sourceTable, String destCat, String destdb, String destTableName) throws MetaException, NoSuchObjectException, - InvalidObjectException, TException{ - return new Partition(); + InvalidObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1099,7 +1121,7 @@ default List exchange_partitions(Map partitionSpecs, String sourceDb, String sourceTable, String destdb, String destTableName) throws MetaException, NoSuchObjectException, InvalidObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1123,7 +1145,7 @@ default List exchange_partitions(Map partitionSpecs, String sourceDb, String sourceTable, String destCat, String destdb, String destTableName) throws MetaException, NoSuchObjectException, InvalidObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1136,8 +1158,8 @@ default List exchange_partitions(Map partitionSpecs, * @throws TException thrift transport error */ default Partition getPartition(String dbName, String tblName, String name) - throws MetaException, UnknownTableException, NoSuchObjectException, TException{ - return new Partition(); + throws MetaException, UnknownTableException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1151,8 +1173,8 @@ default Partition getPartition(String dbName, String tblName, String name) * @throws TException thrift transport error */ default Partition getPartition(String catName, String dbName, String tblName, String name) - throws MetaException, UnknownTableException, NoSuchObjectException, TException{ - return new Partition(); + throws MetaException, UnknownTableException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } @@ -1171,8 +1193,8 @@ default Partition getPartition(String catName, String dbName, String tblName, St */ default Partition getPartitionWithAuthInfo(String dbName, String tableName, List pvals, String userName, List groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException{ - return new Partition(); + throws MetaException, UnknownTableException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1191,8 +1213,8 @@ default Partition getPartitionWithAuthInfo(String dbName, String tableName, */ default Partition getPartitionWithAuthInfo(String catName, String dbName, String tableName, List pvals, String userName, List groupNames) - throws MetaException, UnknownTableException, NoSuchObjectException, TException{ - return new Partition(); + throws MetaException, UnknownTableException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1207,7 +1229,7 @@ default Partition getPartitionWithAuthInfo(String catName, String dbName, String */ default List listPartitions(String db_name, String tbl_name, short max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1223,7 +1245,7 @@ default List listPartitions(String db_name, String tbl_name, short ma */ default List listPartitions(String catName, String db_name, String tbl_name, int max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1236,7 +1258,7 @@ default List listPartitions(String catName, String db_name, String tb */ default PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, int maxParts) throws TException { - return null; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1250,7 +1272,7 @@ default PartitionSpecProxy listPartitionSpecs(String dbName, String tableName, i */ default PartitionSpecProxy listPartitionSpecs(String catName, String dbName, String tableName, int maxParts) throws TException { - return null; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1267,7 +1289,7 @@ default PartitionSpecProxy listPartitionSpecs(String catName, String dbName, Str */ default List listPartitions(String db_name, String tbl_name, List part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1286,7 +1308,7 @@ default List listPartitions(String db_name, String tbl_name, default List listPartitions(String catName, String db_name, String tbl_name, List part_vals, int max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1301,7 +1323,7 @@ default List listPartitions(String catName, String db_name, String tb */ default List listPartitionNames(String db_name, String tbl_name, short max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1314,7 +1336,7 @@ default List listPartitionNames(String db_name, String tbl_name, */ default GetPartitionNamesPsResponse listPartitionNamesRequest(GetPartitionNamesPsRequest req) throws NoSuchObjectException, MetaException, TException { - return new GetPartitionNamesPsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1330,7 +1352,7 @@ default GetPartitionNamesPsResponse listPartitionNamesRequest(GetPartitionNamesP */ default List listPartitionNames(String catName, String db_name, String tbl_name, int max_parts) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1349,7 +1371,7 @@ default List listPartitionNames(String catName, String db_name, String t */ default List listPartitionNames(String db_name, String tbl_name, List part_vals, short max_parts) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1369,7 +1391,7 @@ default List listPartitionNames(String db_name, String tbl_name, List listPartitionNames(String catName, String db_name, String tbl_name, List part_vals, int max_parts) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1382,7 +1404,7 @@ default List listPartitionNames(String catName, String db_name, String t */ default List listPartitionNames(PartitionsByExprRequest request) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1395,7 +1417,7 @@ default List listPartitionNames(PartitionsByExprRequest request) */ default PartitionValuesResponse listPartitionValues(PartitionValuesRequest request) throws MetaException, TException, NoSuchObjectException { - return new PartitionValuesResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1412,7 +1434,7 @@ default PartitionValuesResponse listPartitionValues(PartitionValuesRequest reque */ default int getNumPartitionsByFilter(String dbName, String tableName, String filter) throws MetaException, NoSuchObjectException, TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1430,7 +1452,7 @@ default int getNumPartitionsByFilter(String dbName, String tableName, String fil */ default int getNumPartitionsByFilter(String catName, String dbName, String tableName, String filter) throws MetaException, NoSuchObjectException, TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } @@ -1450,7 +1472,7 @@ default int getNumPartitionsByFilter(String catName, String dbName, String table */ default List listPartitionsByFilter(String db_name, String tbl_name, String filter, short max_parts) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1471,7 +1493,7 @@ default List listPartitionsByFilter(String db_name, String tbl_name, default List listPartitionsByFilter(String catName, String db_name, String tbl_name, String filter, int max_parts) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1488,7 +1510,7 @@ default List listPartitionsByFilter(String catName, String db_name, S */ default PartitionSpecProxy listPartitionSpecsByFilter(String db_name, String tbl_name, String filter, int max_parts) throws MetaException, NoSuchObjectException, TException { - return null; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1506,7 +1528,7 @@ default PartitionSpecProxy listPartitionSpecsByFilter(String db_name, String tbl */ default PartitionSpecProxy listPartitionSpecsByFilter(String catName, String db_name, String tbl_name, String filter, int max_parts) throws MetaException, NoSuchObjectException, TException { - return null; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1516,7 +1538,7 @@ default PartitionSpecProxy listPartitionSpecsByFilter(String catName, String db_ * @throws TException thrift transport error or error executing the filter. */ default boolean listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1535,7 +1557,7 @@ default boolean listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1554,7 +1576,7 @@ default boolean listPartitionsByExpr(String db_name, String tbl_name, */ default boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, byte[] expr, String default_partition_name, int max_parts, List result) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1580,7 +1602,7 @@ default boolean listPartitionsByExpr(String catName, String db_name, String tbl_ default List listPartitionsWithAuthInfo(String dbName, String tableName, short maxParts, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1593,7 +1615,7 @@ default List listPartitionsWithAuthInfo(String dbName, */ default GetPartitionsPsWithAuthResponse listPartitionsWithAuthInfoRequest(GetPartitionsPsWithAuthRequest req) throws MetaException, TException, NoSuchObjectException { - return new GetPartitionsPsWithAuthResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1612,7 +1634,7 @@ default GetPartitionsPsWithAuthResponse listPartitionsWithAuthInfoRequest(GetPar default List listPartitionsWithAuthInfo(String catName, String dbName, String tableName, int maxParts, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1629,7 +1651,7 @@ default List listPartitionsWithAuthInfo(String catName, String dbName @Deprecated default List getPartitionsByNames(String db_name, String tbl_name, List part_names) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1642,7 +1664,7 @@ default List getPartitionsByNames(String db_name, String tbl_name, */ default PartitionsResponse getPartitionsRequest(PartitionsRequest req) throws NoSuchObjectException, MetaException, TException { - return new PartitionsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1654,7 +1676,7 @@ default PartitionsResponse getPartitionsRequest(PartitionsRequest req) * @throws TException thrift transport error */ default GetPartitionsByNamesResult getPartitionsByNames(GetPartitionsByNamesRequest req) throws TException { - return new GetPartitionsByNamesResult(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1673,7 +1695,7 @@ default GetPartitionsByNamesResult getPartitionsByNames(GetPartitionsByNamesRequ default List listPartitionsWithAuthInfo(String dbName, String tableName, List partialPvals, short maxParts, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1692,7 +1714,7 @@ default List listPartitionsWithAuthInfo(String dbName, default List listPartitionsWithAuthInfo( String catName, String dbName, String tableName, List partialPvals, int maxParts, String userName, List groupNames) throws MetaException, TException, NoSuchObjectException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1711,7 +1733,9 @@ default List listPartitionsWithAuthInfo( */ default void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException {} + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark an event as having occurred on a partition. @@ -1730,7 +1754,9 @@ default void markPartitionForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, - UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException {} + UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Determine whether a partition has been marked with a particular event type. @@ -1749,7 +1775,7 @@ default void markPartitionForEvent(String catName, String db_name, String tbl_na default boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1770,7 +1796,7 @@ default boolean isPartitionMarkedForEvent(String db_name, String tbl_name, Map partKVs, PartitionEventType eventType) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException, UnknownPartitionException, InvalidPartitionException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -1778,7 +1804,9 @@ default boolean isPartitionMarkedForEvent(String catName, String db_name, String * @throws TException * @throws MetaException */ - default void validatePartitionNameCharacters(List partVals) throws TException, MetaException{} + default void validatePartitionNameCharacters(List partVals) throws TException, MetaException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Dry run that translates table @@ -1826,7 +1854,9 @@ void createTable(CreateTableRequest request) throws AlreadyExistsException, * @throws TException general thrift exception */ default void alter_table(String databaseName, String tblName, Table table) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a table. Equivalent to @@ -1862,7 +1892,9 @@ default void alter_table(String catName, String dbName, String tblName, Table ne */ default void alter_table(String catName, String dbName, String tblName, Table newTable, EnvironmentContext envContext) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @deprecated Use alter_table_with_environmentContext instead of alter_table with cascade option @@ -1870,7 +1902,9 @@ default void alter_table(String catName, String dbName, String tblName, Table ne */ @Deprecated default void alter_table(String defaultDatabaseName, String tblName, Table table, - boolean cascade) throws InvalidOperationException, MetaException, TException {} + boolean cascade) throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a table. @@ -1887,7 +1921,9 @@ default void alter_table(String defaultDatabaseName, String tblName, Table table @Deprecated default void alter_table_with_environmentContext(String databaseName, String tblName, Table table, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, - TException {} + TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void alter_table(String catName, String databaseName, String tblName, Table table, EnvironmentContext environmentContext, String validWriteIdList) @@ -1987,7 +2023,9 @@ default void dropDatabase(String catName, String dbName, boolean deleteData, boo * @throws TException general thrift error. */ default void alterDatabase(String name, Database db) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a database. @@ -2000,7 +2038,9 @@ default void alterDatabase(String name, Database db) * @throws TException general thrift error. */ default void alterDatabase(String catName, String dbName, Database newDb) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create a new dataconnector. @@ -2011,7 +2051,9 @@ default void alterDatabase(String catName, String dbName, Database newDb) * @throws TException general thrift error */ default void createDataConnector(DataConnector connector) - throws InvalidObjectException, AlreadyExistsException, MetaException, TException {} + throws InvalidObjectException, AlreadyExistsException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a dataconnector. @@ -2024,7 +2066,9 @@ default void createDataConnector(DataConnector connector) * @throws TException general thrift error. */ default void dropDataConnector(String name, boolean ifNotExists, boolean checkReferences) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException {} + throws NoSuchObjectException, InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a dataconnector. @@ -2035,7 +2079,9 @@ default void dropDataConnector(String name, boolean ifNotExists, boolean checkRe * @throws TException thrift transport layer error. */ default void alterDataConnector(String name, DataConnector connector) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the dataconnector by name @@ -2045,7 +2091,7 @@ default void alterDataConnector(String name, DataConnector connector) */ default DataConnector getDataConnector(String name) throws MetaException, TException { - return new DataConnector(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2055,7 +2101,7 @@ default DataConnector getDataConnector(String name) * @throws TException thrift transport error */ default List getAllDataConnectorNames() throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2073,7 +2119,7 @@ default List getAllDataConnectorNames() throws MetaException, TException default boolean dropPartition(String db_name, String tbl_name, List part_vals, boolean deleteData) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2092,7 +2138,7 @@ default boolean dropPartition(String db_name, String tbl_name, default boolean dropPartition(String catName, String db_name, String tbl_name, List part_vals, boolean deleteData) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2110,7 +2156,7 @@ default boolean dropPartition(String catName, String db_name, String tbl_name, default boolean dropPartition(String db_name, String tbl_name, List part_vals, PartitionDropOptions options) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2129,7 +2175,7 @@ default boolean dropPartition(String db_name, String tbl_name, List part default boolean dropPartition(String catName, String db_name, String tbl_name, List part_vals, PartitionDropOptions options) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2151,7 +2197,7 @@ default boolean dropPartition(String catName, String db_name, String tbl_name, L default List dropPartitions(String dbName, String tblName, List> partExprs, boolean deleteData, boolean ifExists) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2184,7 +2230,7 @@ default List dropPartitions(String catName, String dbName, String tbl default List dropPartitions(String dbName, String tblName, List> partExprs, boolean deleteData, boolean ifExists, boolean needResults) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2233,7 +2279,7 @@ default List dropPartitions(String dbName, String tblName, List> partExprs, PartitionDropOptions options) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2252,7 +2298,7 @@ default List dropPartitions(String catName, String dbName, String tbl List> partExprs, PartitionDropOptions options) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } List dropPartitions(String catName, String dbName, String tblName, @@ -2273,7 +2319,7 @@ List dropPartitions(String catName, String dbName, String tblName, default boolean dropPartition(String db_name, String tbl_name, String name, boolean deleteData) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2291,7 +2337,7 @@ default boolean dropPartition(String db_name, String tbl_name, default boolean dropPartition(String catName, String db_name, String tbl_name, String name, boolean deleteData) throws NoSuchObjectException, MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2311,7 +2357,9 @@ default boolean dropPartition(String catName, String db_name, String tbl_name, * if error in communicating with metastore server */ default void alter_partition(String dbName, String tblName, Partition newPart) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a partition to new partition @@ -2331,12 +2379,16 @@ default void alter_partition(String dbName, String tblName, Partition newPart) */ @Deprecated default void alter_partition(String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void alter_partition(String catName, String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext, String writeIdList) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a partition to new partition @@ -2356,7 +2408,9 @@ default void alter_partition(String catName, String dbName, String tblName, Part */ default void alter_partition(String catName, String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2376,7 +2430,9 @@ default void alter_partition(String catName, String dbName, String tblName, Part */ @Deprecated default void alter_partitions(String dbName, String tblName, List newParts) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2398,12 +2454,16 @@ default void alter_partitions(String dbName, String tblName, List new @Deprecated default void alter_partitions(String dbName, String tblName, List newParts, EnvironmentContext environmentContext) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void alter_partitions(String dbName, String tblName, List newParts, EnvironmentContext environmentContext, String writeIdList, long writeId) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2425,7 +2485,9 @@ default void alter_partitions(String dbName, String tblName, List ne default void alter_partitions(String catName, String dbName, String tblName, List newParts, EnvironmentContext environmentContext, String writeIdList, long writeId) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * rename a partition to a new partition @@ -2448,7 +2510,9 @@ default void alter_partitions(String catName, String dbName, String tblName, Lis @Deprecated default void renamePartition(final String dbname, final String tableName, final List part_vals, final Partition newPart) - throws InvalidOperationException, MetaException, TException {} + throws InvalidOperationException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * rename a partition to a new partition @@ -2476,7 +2540,9 @@ default void renamePartition(String catName, String dbname, String tableName, Li default void renamePartition(String catName, String dbname, String tableName, List part_vals, Partition newPart, String validWriteIds, long txnId, boolean makeCopy) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, excluding the partition columns. @@ -2491,7 +2557,7 @@ default void renamePartition(String catName, String dbname, String tableName, Li default List getFields(String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2508,7 +2574,7 @@ default List getFields(String db, String tableName) default List getFields(String catName, String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2523,7 +2589,7 @@ default List getFields(String catName, String db, String tableName) default GetFieldsResponse getFieldsRequest(GetFieldsRequest req) throws MetaException, TException, UnknownTableException, UnknownDBException { - return new GetFieldsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2539,7 +2605,7 @@ default GetFieldsResponse getFieldsRequest(GetFieldsRequest req) default List getSchema(String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2556,7 +2622,7 @@ default List getSchema(String db, String tableName) default List getSchema(String catName, String db, String tableName) throws MetaException, TException, UnknownTableException, UnknownDBException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2571,7 +2637,7 @@ default List getSchema(String catName, String db, String tableName) default GetSchemaResponse getSchemaRequest(GetSchemaRequest req) throws MetaException, TException, UnknownTableException, UnknownDBException { - return new GetSchemaResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2598,7 +2664,7 @@ default String getConfigValue(String name, String defaultValue) */ default List partitionNameToVals(String name) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** * @@ -2610,7 +2676,7 @@ default List partitionNameToVals(String name) */ default Map partitionNameToSpec(String name) throws MetaException, TException { - return Collections.emptyMap(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2626,7 +2692,7 @@ default Map partitionNameToSpec(String name) default boolean updateTableColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2642,7 +2708,7 @@ default boolean updateTableColumnStatistics(ColumnStatistics statsObj) default boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2660,13 +2726,13 @@ default boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) */ default List getTableColumnStatistics(String dbName, String tableName, List colNames, String engine) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default List getTableColumnStatistics(String dbName, String tableName, List colNames, String engine, String validWriteIdList) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2685,13 +2751,13 @@ default List getTableColumnStatistics(String dbName, String */ default List getTableColumnStatistics(String catName, String dbName, String tableName, List colNames, String engine) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default List getTableColumnStatistics(String catName, String dbName, String tableName, List colNames, String engine, String validWriteIdList) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Get the column statistics for a set of columns in a partition. @@ -2709,14 +2775,14 @@ default List getTableColumnStatistics(String catName, Strin default Map> getPartitionColumnStatistics(String dbName, String tableName, List partNames, List colNames, String engine) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyMap(); + throw new UnsupportedOperationException("this method is not supported"); } default Map> getPartitionColumnStatistics(String dbName, String tableName, List partNames, List colNames, String engine, String validWriteIdList) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyMap(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2736,7 +2802,7 @@ default Map> getPartitionColumnStatistics(Stri default Map> getPartitionColumnStatistics( String catName, String dbName, String tableName, List partNames, List colNames, String engine) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyMap(); + throw new UnsupportedOperationException("this method is not supported"); } default Map> getPartitionColumnStatistics( @@ -2744,7 +2810,7 @@ default Map> getPartitionColumnStatistics( List partNames, List colNames, String engine, String validWriteIdList) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyMap(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Delete partition level column statistics given dbName, tableName, partName and colName, or @@ -2881,10 +2947,12 @@ default boolean deleteTableColumnStatistics(String catName, String dbName, Strin * @throws TException thrift transport error */ default boolean deleteColumnStatistics(DeleteColumnStatisticsRequest req) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } - default void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException {} + default void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param role @@ -2895,7 +2963,7 @@ default void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) */ default boolean create_role(Role role) throws MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2906,8 +2974,8 @@ default boolean create_role(Role role) * @throws MetaException * @throws TException */ - default boolean drop_role(String role_name) throws MetaException, TException{ - return false; + default boolean drop_role(String role_name) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2917,7 +2985,7 @@ default boolean drop_role(String role_name) throws MetaException, TException{ * @throws MetaException */ default List listRoleNames() throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2934,8 +3002,8 @@ default List listRoleNames() throws MetaException, TException { */ default boolean grant_role(String role_name, String user_name, PrincipalType principalType, String grantor, PrincipalType grantorType, - boolean grantOption) throws MetaException, TException{ - return false; + boolean grantOption) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2950,8 +3018,8 @@ default boolean grant_role(String role_name, String user_name, * @throws TException */ default boolean revoke_role(String role_name, String user_name, - PrincipalType principalType, boolean grantOption) throws MetaException, TException{ - return false; + PrincipalType principalType, boolean grantOption) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2964,7 +3032,7 @@ default boolean revoke_role(String role_name, String user_name, */ default List list_roles(String principalName, PrincipalType principalType) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2980,7 +3048,7 @@ default List list_roles(String principalName, PrincipalType principalType) default PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, String user_name, List group_names) throws MetaException, TException { - return new PrincipalPrivilegeSet(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -2995,7 +3063,7 @@ default PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject, default List list_privileges(String principal_name, PrincipalType principal_type, HiveObjectRef hiveObject) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3006,7 +3074,7 @@ default List list_privileges(String principal_name, */ default boolean grant_privileges(PrivilegeBag privileges) throws MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3017,7 +3085,7 @@ default boolean grant_privileges(PrivilegeBag privileges) */ default boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) throws MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3029,7 +3097,7 @@ default boolean revoke_privileges(PrivilegeBag privileges, boolean grantOption) */ default boolean refresh_privileges(HiveObjectRef objToRefresh, String authorizer, PrivilegeBag grantPrivileges) throws MetaException, TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3043,7 +3111,7 @@ default boolean refresh_privileges(HiveObjectRef objToRefresh, String authorizer */ default String getDelegationToken(String owner, String renewerKerberosPrincipalName) throws MetaException, TException { - return ""; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3053,7 +3121,7 @@ default String getDelegationToken(String owner, String renewerKerberosPrincipalN * @throws TException */ default long renewDelegationToken(String tokenStrForm) throws MetaException, TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3061,42 +3129,46 @@ default long renewDelegationToken(String tokenStrForm) throws MetaException, TEx * @throws MetaException * @throws TException */ - default void cancelDelegationToken(String tokenStrForm) throws MetaException, TException {} + default void cancelDelegationToken(String tokenStrForm) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default String getTokenStrForm() throws IOException { - return ""; + throw new UnsupportedOperationException("this method is not supported"); } default boolean addToken(String tokenIdentifier, String delegationToken) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } default boolean removeToken(String tokenIdentifier) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } default String getToken(String tokenIdentifier) throws TException { - return ""; + throw new UnsupportedOperationException("this method is not supported"); } default List getAllTokenIdentifiers() throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default int addMasterKey(String key) throws MetaException, TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } default void updateMasterKey(Integer seqNo, String key) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default boolean removeMasterKey(Integer keySeq) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } default String[] getMasterKeys() throws TException { - return new String[0]; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3107,7 +3179,9 @@ default String[] getMasterKeys() throws TException { * @throws TException thrift transport error */ default void createFunction(Function func) - throws InvalidObjectException, MetaException, TException {} + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a function. @@ -3119,7 +3193,9 @@ default void createFunction(Function func) * @throws TException thrift transport error */ default void alterFunction(String dbName, String funcName, Function newFunction) - throws InvalidObjectException, MetaException, TException {} + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a function. @@ -3132,7 +3208,9 @@ default void alterFunction(String dbName, String funcName, Function newFunction) * @throws TException thrift transport error */ default void alterFunction(String catName, String dbName, String funcName, Function newFunction) - throws InvalidObjectException, MetaException, TException {} + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a function. @@ -3145,7 +3223,9 @@ default void alterFunction(String catName, String dbName, String funcName, Funct * @throws TException thrift transport error */ default void dropFunction(String dbName, String funcName) throws MetaException, - NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {} + NoSuchObjectException, InvalidObjectException, InvalidInputException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a function. @@ -3159,7 +3239,9 @@ default void dropFunction(String dbName, String funcName) throws MetaException, * @throws TException thrift transport error */ default void dropFunction(String catName, String dbName, String funcName) throws MetaException, - NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {} + NoSuchObjectException, InvalidObjectException, InvalidInputException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a function. @@ -3170,7 +3252,7 @@ default void dropFunction(String catName, String dbName, String funcName) throws */ default Function getFunction(String dbName, String funcName) throws MetaException, TException { - return new Function(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3183,7 +3265,7 @@ default Function getFunction(String dbName, String funcName) */ default Function getFunction(String catName, String dbName, String funcName) throws MetaException, TException { - return new Function(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3196,7 +3278,7 @@ default Function getFunction(String catName, String dbName, String funcName) @Deprecated default List getFunctions(String dbName, String pattern) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3206,7 +3288,7 @@ default List getFunctions(String dbName, String pattern) */ default GetFunctionsResponse getFunctionsRequest(GetFunctionsRequest functionRequest) throws TException { - return new GetFunctionsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Get all functions matching a pattern @@ -3219,7 +3301,7 @@ default GetFunctionsResponse getFunctionsRequest(GetFunctionsRequest functionReq @Deprecated default List getFunctions(String catName, String dbName, String pattern) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3233,7 +3315,7 @@ default GetAllFunctionsResponse getAllFunctions() throws MetaException, TExcepti } default GetOpenTxnsResponse getOpenTxns() throws TException { - return new GetOpenTxnsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3242,7 +3324,7 @@ default GetOpenTxnsResponse getOpenTxns() throws TException { * @throws TException */ default ValidTxnList getValidTxns() throws TException { - return new ValidReadTxnList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3253,7 +3335,7 @@ default ValidTxnList getValidTxns() throws TException { * @throws TException */ default ValidTxnList getValidTxns(long currentTxn) throws TException { - return new ValidReadTxnList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3265,7 +3347,7 @@ default ValidTxnList getValidTxns(long currentTxn) throws TException { * @throws TException */ default ValidTxnList getValidTxns(long currentTxn, List excludeTxnTypes) throws TException { - return new ValidReadTxnList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3275,7 +3357,7 @@ default ValidTxnList getValidTxns(long currentTxn, List excludeTxnTypes * @throws TException */ default ValidWriteIdList getValidWriteIds(String fullTableName) throws TException { - return new ValidCleanerWriteIdList("", 0); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3286,7 +3368,7 @@ default ValidWriteIdList getValidWriteIds(String fullTableName) throws TExceptio * @throws TException */ default ValidWriteIdList getValidWriteIds(String fullTableName, Long writeId) throws TException { - return new ValidCleanerWriteIdList("", 0); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3299,7 +3381,7 @@ default ValidWriteIdList getValidWriteIds(String fullTableName, Long writeId) th */ default List getValidWriteIds(List tablesList, String validTxnList) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3307,7 +3389,9 @@ default List getValidWriteIds(List tablesList, Strin * @param txnId transaction identifier * @param writeIds list of minOpenWriteId */ - default void addWriteIdsToMinHistory(long txnId, Map writeIds) throws TException {} + default void addWriteIdsToMinHistory(long txnId, Map writeIds) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Initiate a transaction. @@ -3318,7 +3402,7 @@ default void addWriteIdsToMinHistory(long txnId, Map writeIds) thr * @throws TException */ default long openTxn(String user) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3329,7 +3413,7 @@ default long openTxn(String user) throws TException { * @throws TException */ default long openTxn(String user, TxnType txnType) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3346,7 +3430,7 @@ default long openTxn(String user, TxnType txnType) throws TException { * @throws TException */ default List replOpenTxn(String replPolicy, List srcTxnIds, String user, TxnType txnType) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3375,7 +3459,7 @@ default List replOpenTxn(String replPolicy, List srcTxnIds, String u * @throws TException */ default OpenTxnsResponse openTxns(String user, int numTxns) throws TException { - return new OpenTxnsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3387,7 +3471,9 @@ default OpenTxnsResponse openTxns(String user, int numTxns) throws TException { * deleted. * @throws TException */ - default void rollbackTxn(long txnid) throws NoSuchTxnException, TException {} + default void rollbackTxn(long txnid) throws NoSuchTxnException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Rollback a transaction. This will also unlock any locks associated with @@ -3399,7 +3485,9 @@ default void rollbackTxn(long txnid) throws NoSuchTxnException, TException {} * deleted. * @throws TException */ - default void rollbackTxn(AbortTxnRequest abortTxnRequest) throws NoSuchTxnException, TException {} + default void rollbackTxn(AbortTxnRequest abortTxnRequest) throws NoSuchTxnException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Rollback a transaction. This will also unlock any locks associated with @@ -3415,7 +3503,9 @@ default void rollbackTxn(AbortTxnRequest abortTxnRequest) throws NoSuchTxnExcept * deleted. * @throws TException */ - default void replRollbackTxn(long srcTxnid, String replPolicy, TxnType txnType) throws NoSuchTxnException, TException {} + default void replRollbackTxn(long srcTxnid, String replPolicy, TxnType txnType) throws NoSuchTxnException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Commit a transaction. This will also unlock any locks associated with @@ -3429,7 +3519,9 @@ default void replRollbackTxn(long srcTxnid, String replPolicy, TxnType txnType) * @throws TException */ default void commitTxn(long txnid) - throws NoSuchTxnException, TxnAbortedException, TException {} + throws NoSuchTxnException, TxnAbortedException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Like commitTxn but it will atomically store as well a key and a value. This @@ -3455,7 +3547,9 @@ default void commitTxn(long txnid) */ default void commitTxnWithKeyValue(long txnid, long tableId, String key, String value) throws NoSuchTxnException, - TxnAbortedException, TException {} + TxnAbortedException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Commit a transaction. This will also unlock any locks associated with @@ -3470,13 +3564,17 @@ default void commitTxnWithKeyValue(long txnid, long tableId, * @throws TException */ default void commitTxn(CommitTxnRequest rqst) - throws NoSuchTxnException, TxnAbortedException, TException {} + throws NoSuchTxnException, TxnAbortedException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Abort a list of transactions. This is for use by "ABORT TRANSACTIONS" in the grammar. * @throws TException */ - default void abortTxns(List txnids) throws TException {} + default void abortTxns(List txnids) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Abort a list of transactions with additional information of @@ -3484,7 +3582,9 @@ default void abortTxns(List txnids) throws TException {} * @param abortTxnsRequest Information containing txnIds and error codes * @throws TException */ - default void abortTxns(AbortTxnsRequest abortTxnsRequest) throws TException {} + default void abortTxns(AbortTxnsRequest abortTxnsRequest) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3494,7 +3594,7 @@ default void abortTxns(AbortTxnsRequest abortTxnsRequest) throws TException {} * @throws TException */ default long allocateTableWriteId(long txnId, String dbName, String tableName) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3506,7 +3606,7 @@ default long allocateTableWriteId(long txnId, String dbName, String tableName) t * @throws TException */ default long allocateTableWriteId(long txnId, String dbName, String tableName, boolean reallocate) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3518,7 +3618,9 @@ default long allocateTableWriteId(long txnId, String dbName, String tableName, b * @throws TException in case of failure to replicate the writeid state */ default void replTableWriteIdState(String validWriteIdList, String dbName, String tableName, List partNames) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3528,7 +3630,7 @@ default void replTableWriteIdState(String validWriteIdList, String dbName, Strin * @throws TException */ default List allocateTableWriteIdsBatch(List txnIds, String dbName, String tableName) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3541,7 +3643,7 @@ default List allocateTableWriteIdsBatch(List txnIds, String */ default List replAllocateTableWriteIdsBatch(String dbName, String tableName, String replPolicy, List srcTxnToWriteIdList) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3552,7 +3654,7 @@ default List replAllocateTableWriteIdsBatch(String dbName, String * @throws TException */ default long getMaxAllocatedWriteId(String dbName, String tableName) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3562,7 +3664,9 @@ default long getMaxAllocatedWriteId(String dbName, String tableName) throws TExc * @param seedWriteId the start value of writeId * @throws TException */ - default void seedWriteId(String dbName, String tableName, long seedWriteId) throws TException {} + default void seedWriteId(String dbName, String tableName, long seedWriteId) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Seed or increment the global txnId to the given value. @@ -3570,7 +3674,9 @@ default void seedWriteId(String dbName, String tableName, long seedWriteId) thro * @param seedTxnId The seed value for the next transactions * @throws TException */ - default void seedTxnId(long seedTxnId) throws TException {} + default void seedTxnId(long seedTxnId) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Show the list of currently open transactions. This is for use by "show transactions" in the @@ -3580,7 +3686,7 @@ default void seedTxnId(long seedTxnId) throws TException {} * @throws TException */ default GetOpenTxnsInfoResponse showTxns() throws TException { - return new GetOpenTxnsInfoResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3614,7 +3720,7 @@ default GetOpenTxnsInfoResponse showTxns() throws TException { @RetrySemantics.CannotRetry default LockResponse lock(LockRequest request) throws NoSuchTxnException, TxnAbortedException, TException { - return new LockResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3641,7 +3747,7 @@ default LockResponse lock(LockRequest request) default LockResponse checkLock(long lockid) throws NoSuchTxnException, TxnAbortedException, NoSuchLockException, TException { - return new LockResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3656,7 +3762,9 @@ default LockResponse checkLock(long lockid) * @throws TException */ default void unlock(long lockid) - throws NoSuchLockException, TxnOpenException, TException {} + throws NoSuchLockException, TxnOpenException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Show all currently held and waiting locks. @@ -3665,7 +3773,7 @@ default void unlock(long lockid) * @throws TException */ default ShowLocksResponse showLocks(ShowLocksRequest showLocksRequest) throws TException { - return new ShowLocksResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3690,7 +3798,9 @@ default ShowLocksResponse showLocks(ShowLocksRequest showLocksRequest) throws TE */ default void heartbeat(long txnid, long lockid) throws NoSuchLockException, NoSuchTxnException, TxnAbortedException, - TException {} + TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Send heartbeats for a range of transactions. This is for the streaming ingest client that @@ -3703,7 +3813,7 @@ default void heartbeat(long txnid, long lockid) * @throws TException */ default HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws TException { - return new HeartbeatTxnRangeResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3717,7 +3827,7 @@ default HeartbeatTxnRangeResponse heartbeatTxnRange(long min, long max) throws T * @throws TException */ default CompactionResponse compact2(CompactionRequest request) throws TException { - return new CompactionResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3727,14 +3837,14 @@ default CompactionResponse compact2(CompactionRequest request) throws TException * @throws TException */ default ShowCompactResponse showCompactions() throws TException { - return new ShowCompactResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Get a list of compactions for the given request object. */ default ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException { - return new ShowCompactResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3749,7 +3859,7 @@ default ShowCompactResponse showCompactions(ShowCompactRequest request) throws T */ default boolean submitForCleanup(CompactionRequest rqst, long highestWriteId, long txnId) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3765,7 +3875,7 @@ default boolean submitForCleanup(CompactionRequest rqst, long highestWriteId, */ default GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInfo(GetLatestCommittedCompactionInfoRequest request) throws TException { - return new GetLatestCommittedCompactionInfoResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3780,7 +3890,9 @@ default GetLatestCommittedCompactionInfoResponse getLatestCommittedCompactionInf */ default void addDynamicPartitions(long txnId, long writeId, String dbName, String tableName, List partNames, DataOperationType operationType) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Performs the commit/rollback to the metadata storage for insert operator from external storage handler. @@ -3789,7 +3901,9 @@ default void addDynamicPartitions(long txnId, long writeId, String dbName, Strin * * @throws MetaException */ - default void insertTable(Table table, boolean overwrite) throws MetaException {} + default void insertTable(Table table, boolean overwrite) throws MetaException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Checks if there is a conflicting transaction @@ -3797,11 +3911,11 @@ default void insertTable(Table table, boolean overwrite) throws MetaException {} * @return latest txnId in conflict */ default long getLatestTxnIdInConflict(long txnId) throws TException { - return 0; + throw new UnsupportedOperationException("this method is not supported"); } default GetDatabaseObjectsResponse get_databases_req(GetDatabaseObjectsRequest request) throws TException { - return new GetDatabaseObjectsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3856,7 +3970,7 @@ default NotificationEventResponse getNextNotification(long lastEventId, int maxE @InterfaceAudience.LimitedPrivate({"HCatalog"}) default NotificationEventResponse getNextNotification(NotificationEventRequest request, boolean allowGapsInEventIds, NotificationFilter filter) throws TException { - return new NotificationEventResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3877,7 +3991,7 @@ default CurrentNotificationEventId getCurrentNotificationEventId() throws TExcep @InterfaceAudience.LimitedPrivate({"HCatalog"}) default NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) throws TException { - return new NotificationEventsCountResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3890,7 +4004,7 @@ default NotificationEventsCountResponse getNotificationEventsCount(NotificationE @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) default FireEventResponse fireListenerEvent(FireEventRequest request) throws TException { - return new FireEventResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3899,7 +4013,9 @@ default FireEventResponse fireListenerEvent(FireEventRequest request) throws TEx * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - default void addWriteNotificationLog(WriteNotificationLogRequest rqst) throws TException {} + default void addWriteNotificationLog(WriteNotificationLogRequest rqst) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a batch of event related to write operations in an ACID table. @@ -3907,7 +4023,9 @@ default void addWriteNotificationLog(WriteNotificationLogRequest rqst) throws TE * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - default void addWriteNotificationLogInBatch(WriteNotificationLogBatchRequest rqst) throws TException {} + default void addWriteNotificationLogInBatch(WriteNotificationLogBatchRequest rqst) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } class IncompatibleMetastoreException extends MetaException { public IncompatibleMetastoreException(String message) { @@ -3926,7 +4044,7 @@ public IncompatibleMetastoreException(String message) { */ default GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRequest getPrincRoleReq) throws MetaException, TException { - return new GetPrincipalsInRoleResponse(); + throw new UnsupportedOperationException("this method is not supported"); } @@ -3941,7 +4059,7 @@ default GetPrincipalsInRoleResponse get_principals_in_role(GetPrincipalsInRoleRe */ default GetRoleGrantsForPrincipalResponse get_role_grants_for_principal( GetRoleGrantsForPrincipalRequest getRolePrincReq) throws MetaException, TException { - return new GetRoleGrantsForPrincipalResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3958,13 +4076,13 @@ default GetRoleGrantsForPrincipalResponse get_role_grants_for_principal( */ default AggrStats getAggrColStatsFor(String dbName, String tblName, List colNames, List partName, String engine) throws NoSuchObjectException, MetaException, TException { - return new AggrStats(); + throw new UnsupportedOperationException("this method is not supported"); } default AggrStats getAggrColStatsFor(String dbName, String tblName, List colNames, List partName, String engine, String writeIdList) throws NoSuchObjectException, MetaException, TException { - return new AggrStats(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -3984,14 +4102,14 @@ default AggrStats getAggrColStatsFor(String catName, String dbName, String tblNa List colNames, List partNames, String engine) throws NoSuchObjectException, MetaException, TException { - return new AggrStats(); + throw new UnsupportedOperationException("this method is not supported"); } default AggrStats getAggrColStatsFor(String catName, String dbName, String tblName, List colNames, List partNames, String engine, String writeIdList) throws NoSuchObjectException, MetaException, TException { - return new AggrStats(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Set table or partition column statistics. @@ -4005,7 +4123,7 @@ default AggrStats getAggrColStatsFor(String catName, String dbName, String tblNa */ default boolean setPartitionColumnStatistics(SetPartitionsStatsRequest request) throws NoSuchObjectException, InvalidObjectException, MetaException, TException, InvalidInputException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4019,31 +4137,35 @@ default void flushCache() {} * The metadata that is not cached in metastore may be missing. */ default Iterable> getFileMetadata(List fileIds) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default Iterable> getFileMetadataBySarg( List fileIds, ByteBuffer sarg, boolean doGetFooters) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Cleares the file metadata cache for respective file IDs. */ - default void clearFileMetadata(List fileIds) throws TException {} + default void clearFileMetadata(List fileIds) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Adds file metadata for respective file IDs to metadata cache in metastore. */ - default void putFileMetadata(List fileIds, List metadata) throws TException {} + default void putFileMetadata(List fileIds, List metadata) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default boolean isSameConfObj(Configuration c) { - return false; + throw new UnsupportedOperationException("this method is not supported"); } default boolean cacheFileMetadata(String dbName, String tableName, String partName, boolean allParts) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4056,7 +4178,7 @@ default boolean cacheFileMetadata(String dbName, String tableName, String partNa */ default List getPrimaryKeys(PrimaryKeysRequest request) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4069,7 +4191,7 @@ default List getPrimaryKeys(PrimaryKeysRequest request) */ default List getForeignKeys(ForeignKeysRequest request) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4082,7 +4204,7 @@ default List getForeignKeys(ForeignKeysRequest request) throws Me */ default List getUniqueConstraints(UniqueConstraintsRequest request) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4100,7 +4222,7 @@ default List getNotNullConstraints(NotNullConstraintsReque default List getDefaultConstraints(DefaultConstraintsRequest request) throws MetaException, NoSuchObjectException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default List getCheckConstraints(CheckConstraintsRequest request) throws MetaException, @@ -4128,7 +4250,9 @@ default void createTableWithConstraints( List notNullConstraints, List defaultConstraints, List checkConstraints) - throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {} + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -4141,7 +4265,9 @@ default void createTableWithConstraints( * @throws TException thrift transport error */ default void dropConstraint(String dbName, String tableName, String constraintName) - throws MetaException, NoSuchObjectException, TException {} + throws MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -4155,7 +4281,9 @@ default void dropConstraint(String dbName, String tableName, String constraintNa * @throws TException thrift transport error */ default void dropConstraint(String catName, String dbName, String tableName, String constraintName) - throws MetaException, NoSuchObjectException, TException {} + throws MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** @@ -4166,7 +4294,9 @@ default void dropConstraint(String catName, String dbName, String tableName, Str * @throws TException thrift transport error */ default void addPrimaryKey(List primaryKeyCols) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a foreign key @@ -4176,7 +4306,9 @@ default void addPrimaryKey(List primaryKeyCols) throws * @throws TException thrift transport error */ default void addForeignKey(List foreignKeyCols) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a unique constraint @@ -4186,7 +4318,9 @@ default void addForeignKey(List foreignKeyCols) throws * @throws TException thrift transport error */ default void addUniqueConstraint(List uniqueConstraintCols) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a not null constraint @@ -4197,13 +4331,19 @@ default void addUniqueConstraint(List uniqueConstraintCols) * @throws TException thrift transport error */ default void addNotNullConstraint(List notNullConstraintCols) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void addDefaultConstraint(List defaultConstraints) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void addCheckConstraint(List checkConstraints) throws - MetaException, NoSuchObjectException, TException {} + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Gets the unique id of the backing database instance used for storing metadata @@ -4212,27 +4352,33 @@ default void addCheckConstraint(List checkConstraints) throw * @throws TException in case of Thrift errors */ default String getMetastoreDbUuid() throws MetaException, TException { - return ""; + throw new UnsupportedOperationException("this method is not supported"); } default void createResourcePlan(WMResourcePlan resourcePlan, String copyFromName) - throws InvalidObjectException, MetaException, TException {} + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - WMFullResourcePlan getResourcePlan(String resourcePlanName, String ns) - throws NoSuchObjectException, MetaException, TException; + default WMFullResourcePlan getResourcePlan(String resourcePlanName, String ns) + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default List getAllResourcePlans(String ns) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default void dropResourcePlan(String resourcePlanName, String ns) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default WMFullResourcePlan alterResourcePlan(String resourcePlanName, String ns, WMNullableResourcePlan resourcePlan, boolean canActivateDisabled, boolean isForceDeactivate, boolean isReplace) throws NoSuchObjectException, InvalidObjectException, MetaException, TException { - return new WMFullResourcePlan(); + throw new UnsupportedOperationException("this method is not supported"); } default WMFullResourcePlan getActiveResourcePlan(String ns) throws MetaException, TException { @@ -4241,41 +4387,59 @@ default WMFullResourcePlan getActiveResourcePlan(String ns) throws MetaException default WMValidateResourcePlanResponse validateResourcePlan(String resourcePlanName, String ns) throws NoSuchObjectException, InvalidObjectException, MetaException, TException { - return new WMValidateResourcePlanResponse(); + throw new UnsupportedOperationException("this method is not supported"); } default void createWMTrigger(WMTrigger trigger) - throws InvalidObjectException, MetaException, TException {} + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void alterWMTrigger(WMTrigger trigger) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException {} + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void dropWMTrigger(String resourcePlanName, String triggerName, String ns) - throws NoSuchObjectException, MetaException, TException {} + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default List getTriggersForResourcePlan(String resourcePlan, String ns) throws NoSuchObjectException, MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default void createWMPool(WMPool pool) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException {} + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void alterWMPool(WMNullablePool pool, String poolPath) - throws NoSuchObjectException, InvalidObjectException, TException {} + throws NoSuchObjectException, InvalidObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void dropWMPool(String resourcePlanName, String poolPath, String ns) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void createOrUpdateWMMapping(WMMapping mapping, boolean isUpdate) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void dropWMMapping(WMMapping mapping) - throws TException {} + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } default void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerName, String poolPath, boolean shouldDrop, String ns) throws AlreadyExistsException, NoSuchObjectException, - InvalidObjectException, MetaException, TException {} + InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create a new schema. This is really a schema container, as there will be specific versions @@ -4286,7 +4450,9 @@ default void createOrDropTriggerToPoolMapping(String resourcePlanName, String tr * @throws MetaException general metastore error * @throws TException general thrift error */ - default void createISchema(ISchema schema) throws TException {} + default void createISchema(ISchema schema) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter an existing schema. @@ -4298,7 +4464,9 @@ default void createISchema(ISchema schema) throws TException {} * @throws MetaException general metastore error * @throws TException general thrift error */ - default void alterISchema(String catName, String dbName, String schemaName, ISchema newSchema) throws TException {} + default void alterISchema(String catName, String dbName, String schemaName, ISchema newSchema) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetch a schema. @@ -4311,7 +4479,7 @@ default void alterISchema(String catName, String dbName, String schemaName, ISch * @throws TException general thrift error */ default ISchema getISchema(String catName, String dbName, String name) throws TException { - return new ISchema(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4324,7 +4492,9 @@ default ISchema getISchema(String catName, String dbName, String name) throws TE * @throws MetaException general metastore error * @throws TException general thrift error */ - default void dropISchema(String catName, String dbName, String name) throws TException {} + default void dropISchema(String catName, String dbName, String name) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a new version to an existing schema. @@ -4334,7 +4504,9 @@ default void dropISchema(String catName, String dbName, String name) throws TExc * @throws MetaException general metastore error * @throws TException general thrift error */ - default void addSchemaVersion(SchemaVersion schemaVersion) throws TException {} + default void addSchemaVersion(SchemaVersion schemaVersion) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a specific version of a schema. @@ -4348,7 +4520,7 @@ default void addSchemaVersion(SchemaVersion schemaVersion) throws TException {} */ default SchemaVersion getSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException { - return new SchemaVersion(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4363,7 +4535,7 @@ default SchemaVersion getSchemaVersion(String catName, String dbName, String sch * @throws TException general thrift error */ default SchemaVersion getSchemaLatestVersion(String catName, String dbName, String schemaName) throws TException { - return new SchemaVersion(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4378,7 +4550,7 @@ default SchemaVersion getSchemaLatestVersion(String catName, String dbName, Stri * @throws TException general thrift error */ default List getSchemaAllVersions(String catName, String dbName, String schemaName) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4393,7 +4565,9 @@ default List getSchemaAllVersions(String catName, String dbName, * @throws MetaException general metastore error * @throws TException general thrift error */ - default void dropSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException {} + default void dropSchemaVersion(String catName, String dbName, String schemaName, int version) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Find all schema versions that have columns that match a query. @@ -4404,7 +4578,7 @@ default void dropSchemaVersion(String catName, String dbName, String schemaName, * @throws TException general thrift error */ default FindSchemasByColsResp getSchemaByCols(FindSchemasByColsRqst rqst) throws TException { - return new FindSchemasByColsResp(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4420,7 +4594,9 @@ default FindSchemasByColsResp getSchemaByCols(FindSchemasByColsRqst rqst) throws * @throws MetaException general metastore error * @throws TException general thrift error */ - default void mapSchemaVersionToSerde(String catName, String dbName, String schemaName, int version, String serdeName) throws TException {} + default void mapSchemaVersionToSerde(String catName, String dbName, String schemaName, int version, String serdeName) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Set the state of a schema version. @@ -4434,7 +4610,9 @@ default void mapSchemaVersionToSerde(String catName, String dbName, String schem * @throws MetaException general metastore error * @throws TException general thrift error */ - default void setSchemaVersionState(String catName, String dbName, String schemaName, int version, SchemaVersionState state) throws TException {} + default void setSchemaVersionState(String catName, String dbName, String schemaName, int version, SchemaVersionState state) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4444,7 +4622,9 @@ default void setSchemaVersionState(String catName, String dbName, String schemaN * @throws MetaException general metastore error * @throws TException general thrift error */ - default void addSerDe(SerDeInfo serDeInfo) throws TException {} + default void addSerDe(SerDeInfo serDeInfo) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetch a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4456,7 +4636,7 @@ default void addSerDe(SerDeInfo serDeInfo) throws TException {} * @throws TException general thrift error */ default SerDeInfo getSerDe(String serDeName) throws TException { - return new SerDeInfo(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4470,7 +4650,7 @@ default SerDeInfo getSerDe(String serDeName) throws TException { * the status can be either ACQUIRED or NOT ACQUIRED */ default LockResponse lockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException { - return new LockResponse(); + throw new UnsupportedOperationException("this method is not supported"); } @@ -4482,15 +4662,17 @@ default LockResponse lockMaterializationRebuild(String dbName, String tableName, * @return true if the lock could be renewed, false otherwise */ default boolean heartbeatLockMaterializationRebuild(String dbName, String tableName, long txnId) throws TException { - return false; + throw new UnsupportedOperationException("this method is not supported"); } /** Adds a RuntimeStat for metastore persistence. */ - default void addRuntimeStat(RuntimeStat stat) throws TException {} + default void addRuntimeStat(RuntimeStat stat) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** Reads runtime statistics. */ default List getRuntimeStats(int maxWeight, int maxCreateTime) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4510,7 +4692,7 @@ default List getRuntimeStats(int maxWeight, int maxCreateTime) thro * Partitions can be filtered by names, by values or by partition expressions. */ default GetPartitionsResponse getPartitionsWithSpecs(GetPartitionsRequest request) throws TException { - return new GetPartitionsResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4521,7 +4703,7 @@ default GetPartitionsResponse getPartitionsWithSpecs(GetPartitionsRequest reques * @throws TException */ default OptionalCompactionInfoStruct findNextCompact(FindNextCompactRequest rqst) throws MetaException, TException { - return new OptionalCompactionInfoStruct(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4530,7 +4712,9 @@ default OptionalCompactionInfoStruct findNextCompact(FindNextCompactRequest rqst * @param txnId transaction id. * @throws TException */ - default void updateCompactorState(CompactionInfoStruct cr, long txnId) throws TException {} + default void updateCompactorState(CompactionInfoStruct cr, long txnId) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get columns. @@ -4539,7 +4723,7 @@ default void updateCompactorState(CompactionInfoStruct cr, long txnId) throws TE * @throws TException */ default List findColumnsWithStats(CompactionInfoStruct cr) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4548,7 +4732,9 @@ default List findColumnsWithStats(CompactionInfoStruct cr) throws TExcep * @throws MetaException * @throws TException */ - default void markCleaned(CompactionInfoStruct cr) throws MetaException, TException {} + default void markCleaned(CompactionInfoStruct cr) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a finished compaction as compacted. @@ -4556,7 +4742,9 @@ default void markCleaned(CompactionInfoStruct cr) throws MetaException, TExcepti * @throws MetaException * @throws TException */ - default void markCompacted(CompactionInfoStruct cr) throws MetaException, TException {} + default void markCompacted(CompactionInfoStruct cr) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a finished compaction as failed. @@ -4564,7 +4752,9 @@ default void markCompacted(CompactionInfoStruct cr) throws MetaException, TExcep * @throws MetaException * @throws TException */ - default void markFailed(CompactionInfoStruct cr) throws MetaException, TException {} + default void markFailed(CompactionInfoStruct cr) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a compaction as refused (to run). @@ -4572,7 +4762,9 @@ default void markFailed(CompactionInfoStruct cr) throws MetaException, TExceptio * @throws MetaException * @throws TException */ - default void markRefused(CompactionInfoStruct cr) throws MetaException, TException {} + default void markRefused(CompactionInfoStruct cr) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create, update or delete one record in the compaction metrics cache. @@ -4591,7 +4783,9 @@ default void markRefused(CompactionInfoStruct cr) throws MetaException, TExcepti * @throws MetaException * @throws TException */ - boolean updateCompactionMetricsData(CompactionMetricsDataStruct struct) throws MetaException, TException; + default boolean updateCompactionMetricsData(CompactionMetricsDataStruct struct) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** @@ -4600,7 +4794,9 @@ default void markRefused(CompactionInfoStruct cr) throws MetaException, TExcepti * @throws MetaException * @throws TException */ - default void removeCompactionMetricsData(CompactionMetricsDataRequest request) throws MetaException, TException {} + default void removeCompactionMetricsData(CompactionMetricsDataRequest request) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Set the hadoop id for a compaction. * @param jobId mapreduce job id that will do the compaction. @@ -4608,7 +4804,9 @@ default void removeCompactionMetricsData(CompactionMetricsDataRequest request) t * @throws MetaException * @throws TException */ - default void setHadoopJobid(String jobId, long cqId) throws MetaException, TException {} + default void setHadoopJobid(String jobId, long cqId) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Gets the version string of the metastore server which this client is connected to @@ -4616,7 +4814,7 @@ default void setHadoopJobid(String jobId, long cqId) throws MetaException, TExce * @return String representation of the version number of Metastore server (eg: 3.1.0-SNAPSHOT) */ default String getServerVersion() throws TException { - return ""; + throw new UnsupportedOperationException("this method is not supported"); } /** @@ -4625,13 +4823,15 @@ default String getServerVersion() throws TException { * @throws NoSuchObjectException if an object by the given name dosen't exists. */ default ScheduledQuery getScheduledQuery(ScheduledQueryKey scheduleKey) throws TException { - return new ScheduledQuery(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Carries out maintenance of scheduled queries (insert/update/drop). */ - default void scheduledQueryMaintenance(ScheduledQueryMaintenanceRequest request) throws MetaException, TException {} + default void scheduledQueryMaintenance(ScheduledQueryMaintenanceRequest request) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Checks whenever a query is available for execution. @@ -4639,60 +4839,72 @@ default void scheduledQueryMaintenance(ScheduledQueryMaintenanceRequest request) * @return optionally a scheduled query to be processed. */ default ScheduledQueryPollResponse scheduledQueryPoll(ScheduledQueryPollRequest request) throws MetaException, TException { - return new ScheduledQueryPollResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** * Registers the progress a scheduled query being executed. */ - default void scheduledQueryProgress(ScheduledQueryProgressInfo info) throws TException {} + default void scheduledQueryProgress(ScheduledQueryProgressInfo info) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Adds replication metrics for the replication policies. * @param replicationMetricList * @throws MetaException */ - default void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException {} + default void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest replicationMetricsRequest) throws MetaException, TException { - return new ReplicationMetricList(); + throw new UnsupportedOperationException("this method is not supported"); } - default void createStoredProcedure(StoredProcedure proc) throws NoSuchObjectException, MetaException, TException {} + default void createStoredProcedure(StoredProcedure proc) throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default StoredProcedure getStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException { - return new StoredProcedure(); + throw new UnsupportedOperationException("this method is not supported"); } - default void dropStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException {} + default void dropStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default List getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } - default void addPackage(AddPackageRequest request) throws NoSuchObjectException, MetaException, TException {} + default void addPackage(AddPackageRequest request) throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } default Package findPackage(GetPackageRequest request) throws TException { - return new Package(); + throw new UnsupportedOperationException("this method is not supported"); } default List listPackages(ListPackageRequest request) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } - default void dropPackage(DropPackageRequest request) throws TException {} + default void dropPackage(DropPackageRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get acid write events of a specific transaction. * @throws TException */ default List getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException { - return Collections.emptyList(); + throw new UnsupportedOperationException("this method is not supported"); } default AbortCompactResponse abortCompactions(AbortCompactionRequest request) throws TException { - return new AbortCompactResponse(); + throw new UnsupportedOperationException("this method is not supported"); } /** From 1b24562c8dc38b9a200236332ac17af41a329e26 Mon Sep 17 00:00:00 2001 From: Zoltan Ratkai Date: Fri, 18 Jul 2025 09:01:43 +0200 Subject: [PATCH 3/3] HIVE-28658 review comment fixes 2 Change-Id: I74283d2010197675219ca45543b433413578c95f --- README.md | 44 ----- data/conf/iceberg/llap/hive-site.xml | 39 ++++ .../HiveIcebergRESTCatalogClientAdapter.java | 180 +++--------------- ...stHiveIcebergRESTCatalogClientAdapter.java | 2 +- .../java/org/apache/iceberg/mr/Catalogs.java | 4 +- iceberg/pom.xml | 15 -- .../ql/metadata/IMetaStoreClientFactory.java | 4 +- .../hive/metastore/IMetaStoreClient.java | 10 +- 8 files changed, 77 insertions(+), 221 deletions(-) diff --git a/README.md b/README.md index 93c6c3e46289..7a2f82c9fd85 100644 --- a/README.md +++ b/README.md @@ -109,50 +109,6 @@ Upgrading from older versions of Hive different database for your MetaStore you will need to provide your own upgrade script. -Using Iceberg REST catalog -========================== -To enable Apache Iceberg REST catalog usage add the followings in hive-site.xml - - - connector.name - iceberg - - - - iceberg.rest-catalog.type - rest - - - iceberg.rest-catalog.uri - {restServerUrl} - -For OAUTH2 authentication add this as well: - - - iceberg.rest-catalog.security - OAUTH2 - - - iceberg.rest-catalog.credential - {user:pass} - - - iceberg.rest-catalog.scope - PRINCIPAL_ROLE:ALL - - - iceberg.rest-catalog.oauth2.credential - {user:pass} - - - iceberg.rest-catalog.oauth2.scope - PRINCIPAL_ROLE:ALL - - - iceberg.rest-catalog.warehouse - {catalogName} - - Useful mailing lists ==================== diff --git a/data/conf/iceberg/llap/hive-site.xml b/data/conf/iceberg/llap/hive-site.xml index 545a8b824617..3b2818a1ec74 100644 --- a/data/conf/iceberg/llap/hive-site.xml +++ b/data/conf/iceberg/llap/hive-site.xml @@ -397,4 +397,43 @@ hive.lock.sleep.between.retries 2 + + + + connector.name + iceberg + + + iceberg.rest-catalog.type + rest + + + iceberg.rest-catalog.uri + {restServerUrl} + + + + iceberg.rest-catalog.security + OAUTH2 + + + iceberg.rest-catalog.credential + {user:pass} + + + iceberg.rest-catalog.scope + PRINCIPAL_ROLE:ALL + + + iceberg.rest-catalog.oauth2.credential + {user:pass} + + + iceberg.rest-catalog.oauth2.scope + PRINCIPAL_ROLE:ALL + + + iceberg.rest-catalog.warehouse + {catalogName} + diff --git a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java index 801adc253bdf..3da6b7cce918 100644 --- a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java @@ -26,9 +26,6 @@ import java.util.Properties; import java.util.stream.Collectors; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hive.metastore.HiveMetaHook; -import org.apache.hadoop.hive.metastore.HiveMetaHookLoader; -import org.apache.hadoop.hive.metastore.IMetaStoreClient; import org.apache.hadoop.hive.metastore.TableType; import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; import org.apache.hadoop.hive.metastore.api.CompactionMetricsDataStruct; @@ -38,7 +35,6 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.GetTableRequest; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; -import org.apache.hadoop.hive.metastore.api.InvalidOperationException; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.api.PrincipalType; @@ -49,11 +45,11 @@ import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey; import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint; import org.apache.hadoop.hive.metastore.api.SerDeInfo; -import org.apache.hadoop.hive.metastore.api.ShowLocksResponse; import org.apache.hadoop.hive.metastore.api.StorageDescriptor; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.api.UnknownDBException; import org.apache.hadoop.hive.metastore.api.WMFullResourcePlan; +import org.apache.hadoop.hive.metastore.client.BaseMetaStoreClient; import org.apache.hadoop.hive.serde.serdeConstants; import org.apache.iceberg.BaseTable; import org.apache.iceberg.CatalogUtil; @@ -70,7 +66,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class HiveIcebergRESTCatalogClientAdapter implements IMetaStoreClient { +public class HiveIcebergRESTCatalogClientAdapter extends BaseMetaStoreClient { private static final Logger LOG = LoggerFactory.getLogger(HiveIcebergRESTCatalogClientAdapter.class); public static final String NAMESPACE_SEPARATOR = "."; @@ -87,13 +83,12 @@ public class HiveIcebergRESTCatalogClientAdapter implements IMetaStoreClient { public static final String WAREHOUSE = "warehouse"; private final Configuration conf; private RESTCatalog restCatalog; - private final HiveMetaHookLoader hookLoader; private final long maxHiveTablePropertySize; - public HiveIcebergRESTCatalogClientAdapter(Configuration conf, HiveMetaHookLoader hookLoader) { + public HiveIcebergRESTCatalogClientAdapter(Configuration conf) { + super(conf); this.conf = conf; - this.hookLoader = hookLoader; this.maxHiveTablePropertySize = conf.getLong(HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE, HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE_DEFAULT); } @@ -130,18 +125,9 @@ private static Map getCatalogPropertiesFromConf( return catalogProperties; } - @Override - public List getDatabases(String databasePattern) throws MetaException, TException { - return getAllDatabases(); - } @Override public List getDatabases(String catName, String databasePattern) throws MetaException, TException { - return getAllDatabases(); - } - - @Override - public List getAllDatabases() throws MetaException, TException { return restCatalog.listNamespaces(Namespace.empty()).stream().map(Namespace::toString).collect(Collectors.toList()); } @@ -150,24 +136,12 @@ public List getAllDatabases(String catName) throws MetaException, TExcep return getAllDatabases(); } - @Override - public List getTables(String dbName, String tablePattern) - throws MetaException, TException, UnknownDBException { - return getTables(null, dbName, tablePattern, null); - } - @Override public List getTables(String catName, String dbName, String tablePattern) throws MetaException, TException, UnknownDBException { return getTables(catName, dbName, tablePattern, null); } - @Override - public List getTables(String dbName, String tablePattern, TableType tableType) - throws MetaException, TException, UnknownDBException { - return getTables(null, dbName, tablePattern, tableType); - } - @Override public List getTables(String catName, String dbName, String tablePattern, TableType tableType) throws MetaException, TException, UnknownDBException { @@ -175,56 +149,17 @@ public List getTables(String catName, String dbName, String tablePattern return tableIdentifiers.stream().map(tableIdentifier -> tableIdentifier.name()).collect(Collectors.toList()); } - - @Override - public List getAllTables(String dbName) throws MetaException, TException, UnknownDBException { - return getTables(null, dbName, "", null); - } - @Override public List getAllTables(String catName, String dbName) throws MetaException, TException, UnknownDBException { return getTables(catName, dbName, "", null); } - @Override - public void dropTable(String dbname, String tableName, boolean deleteData, boolean ignoreUnknownTab) - throws MetaException, TException, NoSuchObjectException { - dropTable(dbname, tableName); - } - - @Override - public void dropTable(String dbname, String tableName, boolean deleteData, boolean ignoreUnknownTab, boolean ifPurge) - throws MetaException, TException, NoSuchObjectException { - dropTable(dbname, tableName); - } - @Override public void dropTable(Table table, boolean deleteData, boolean ignoreUnknownTab, boolean ifPurge) throws TException { + restCatalog.dropTable(TableIdentifier.of(table.getDbName(), table.getTableName())); dropTable(table.getDbName(), table.getTableName()); } - @Override - public void dropTable(String dbname, String tableName) throws MetaException, TException, NoSuchObjectException { - restCatalog.dropTable(TableIdentifier.of(dbname, tableName)); - } - - @Override - public void dropTable(String catName, String dbName, String tableName, boolean deleteData, boolean ignoreUnknownTable, - boolean ifPurge) throws MetaException, NoSuchObjectException, TException { - dropTable(dbName, tableName); - } - - @Override - public boolean tableExists(String databaseName, String tableName) - throws MetaException, TException, UnknownDBException { - try { - getTables(databaseName, tableName); - } catch (NoSuchTableException e) { - return false; - } - return true; - } - @Override public boolean tableExists(String catName, String dbName, String tableName) throws MetaException, TException, UnknownDBException { @@ -232,7 +167,8 @@ public boolean tableExists(String catName, String dbName, String tableName) } @Override - public Database getDatabase(String databaseName) throws NoSuchObjectException, MetaException, TException { + public Database getDatabase(String catalogName, String databaseName) + throws NoSuchObjectException, MetaException, TException { return restCatalog.listNamespaces(Namespace.empty()).stream() .filter(namespace -> namespace.levels()[0].equals(databaseName)).map(namespace -> { Database database = new Database(); @@ -250,24 +186,6 @@ public Database getDatabase(String databaseName) throws NoSuchObjectException, M }).findFirst().get(); } - @Override - public Database getDatabase(String catalogName, String databaseName) - throws NoSuchObjectException, MetaException, TException { - return getDatabase(databaseName); - } - - @Override - public Table getTable(String dbName, String tableName) throws MetaException, TException, NoSuchObjectException { - org.apache.iceberg.Table icebergTable = null; - try { - icebergTable = restCatalog.loadTable(TableIdentifier.of(dbName, tableName)); - } catch (NoSuchTableException exception) { - throw new NoSuchObjectException(); - } - Table hiveTable = convertIcebergTableToHiveTable(icebergTable); - return hiveTable; - } - private Table convertIcebergTableToHiveTable(org.apache.iceberg.Table icebergTable) { Table hiveTable = new Table(); TableMetadata metadata = ((BaseTable) icebergTable).operations().current(); @@ -315,45 +233,33 @@ private String getDbName(org.apache.iceberg.Table icebergTable) { return nameParts.length == 3 ? nameParts[1] : nameParts[0]; } - @Override - public Table getTable(String dbName, String tableName, boolean getColumnStats, String engine) - throws MetaException, TException, NoSuchObjectException { - return getTable(dbName, tableName); - } - - @Override - public Table getTable(String catName, String dbName, String tableName) throws MetaException, TException { - return getTable(dbName, tableName); - } - - @Override - public Table getTable(String catName, String dbName, String tableName, String validWriteIdList) throws TException { - return getTable(dbName, tableName); - } - - @Override - public Table getTable(String catName, String dbName, String tableName, String validWriteIdList, - boolean getColumnStats, String engine) throws TException { - return getTable(dbName, tableName); - } - @Override public Table getTable(GetTableRequest getTableRequest) throws MetaException, TException, NoSuchObjectException { - return getTable(getTableRequest.getDbName(), getTableRequest.getTblName()); + org.apache.iceberg.Table icebergTable = null; + try { + icebergTable = restCatalog.loadTable( + TableIdentifier.of(getTableRequest.getDbName(), getTableRequest.getTblName())); + } catch (NoSuchTableException exception) { + throw new NoSuchObjectException(); + } + Table hiveTable = convertIcebergTableToHiveTable(icebergTable); + return hiveTable; } - public void createTable(Table tbl) + @Override + public void createTable(CreateTableRequest request) throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { - List cols = Lists.newArrayList(tbl.getSd().getCols()); - if (tbl.isSetPartitionKeys() && !tbl.getPartitionKeys().isEmpty()) { - cols.addAll(tbl.getPartitionKeys()); + Table table = request.getTable(); + List cols = Lists.newArrayList(table.getSd().getCols()); + if (table.isSetPartitionKeys() && !table.getPartitionKeys().isEmpty()) { + cols.addAll(table.getPartitionKeys()); } - Properties catalogProperties = HMSTablePropertyHelper.getCatalogProperties(tbl); + Properties catalogProperties = HMSTablePropertyHelper.getCatalogProperties(table); Schema schema = HiveSchemaUtil.convert(cols, true); SortOrder sortOrder = HMSTablePropertyHelper.getSortOrder(catalogProperties, schema); org.apache.iceberg.PartitionSpec partitionSpec = HMSTablePropertyHelper.createPartitionSpec(this.conf, schema); - org.apache.iceberg.Table table = restCatalog - .buildTable(TableIdentifier.of(tbl.getDbName(), tbl.getTableName()), schema) + restCatalog + .buildTable(TableIdentifier.of(table.getDbName(), table.getTableName()), schema) .withPartitionSpec(partitionSpec) .withLocation(catalogProperties.getProperty(LOCATION)) .withSortOrder(sortOrder) @@ -367,18 +273,6 @@ public void createTable(Table tbl) .create(); } - private HiveMetaHook getHook(Table tbl) throws MetaException { - if (hookLoader == null) { - return null; - } - return hookLoader.getHook(tbl); - } - @Override - public void createTable(CreateTableRequest request) - throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { - createTable(request.getTable()); - } - @Override public void createDatabase(Database db) throws InvalidObjectException, AlreadyExistsException, MetaException, TException { @@ -389,32 +283,10 @@ public void createDatabase(Database db) restCatalog.createNamespace(Namespace.of(db.getName()), props); } - @Override - public void dropDatabase(String name) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException { - restCatalog.dropNamespace(Namespace.of(name)); - } - - @Override - public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException { - dropDatabase(name); - } - - @Override - public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownDb, boolean cascade) - throws NoSuchObjectException, InvalidOperationException, MetaException, TException { - dropDatabase(name); - } @Override public void dropDatabase(DropDatabaseRequest req) throws TException { - dropDatabase(req.getName()); - } - - @Override - public ShowLocksResponse showLocks() throws TException { - return null; + restCatalog.dropNamespace(Namespace.of(req.getName())); } @Override diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java index 2224fe7c741a..877122a1aedd 100644 --- a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java +++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java @@ -67,7 +67,7 @@ public static void before() throws MetaException { catalogUtilMockedStatic = Mockito.mockStatic(CatalogUtil.class); restCatalog = Mockito.mock(RESTCatalog.class); catalogUtilMockedStatic.when(() -> CatalogUtil.buildIcebergCatalog(any(), any(), any())).thenReturn(restCatalog); - hiveIcebergRESTCatalogClientAdapter = Mockito.spy(new HiveIcebergRESTCatalogClientAdapter(configuration, null)); + hiveIcebergRESTCatalogClientAdapter = Mockito.spy(new HiveIcebergRESTCatalogClientAdapter(configuration)); hiveIcebergRESTCatalogClientAdapter.reconnect(); TableOperations ops = new TableOperations() { @Override diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java index 868bb783441a..eab35a5327ee 100644 --- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java +++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java @@ -257,7 +257,7 @@ static Optional loadCatalog(Configuration conf, String catalogName) { */ private static Map getCatalogProperties(Configuration conf, String catalogName) { Map catalogProperties = Maps.newHashMap(); - String keyPrefix = REST_CATALOG_TYPE.equals(catalogType) ? + String keyPrefix = REST_CATALOG_TYPE.equals(catalogName) ? InputFormatConfig.CATALOG_REST_CONFIG_PREFIX : InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName; conf.forEach(config -> { if (config.getKey().startsWith(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX)) { @@ -270,7 +270,7 @@ private static Map getCatalogProperties(Configuration conf, Stri config.getValue()); } }); - if (REST_CATALOG_TYPE.equals(catalogType)) { + if (REST_CATALOG_TYPE.equals(catalogName)) { catalogProperties.put("type", "rest"); } return catalogProperties; diff --git a/iceberg/pom.xml b/iceberg/pom.xml index 6780d80818e7..b08885f5dc81 100644 --- a/iceberg/pom.xml +++ b/iceberg/pom.xml @@ -221,21 +221,6 @@ value ${immutables.value.version} - - org.apache.httpcomponents.client5 - httpclient5 - ${httpcomponents5.client.version} - - - org.apache.httpcomponents.core5 - httpcore5 - ${httpcomponents5.core.version} - - - org.apache.httpcomponents.core5 - httpcore5-h2 - ${httpcomponents5.core.version} - diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java index 87dad1bf5202..03dda9fa9e88 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java @@ -65,8 +65,8 @@ private static IMetaStoreClient getHiveIcebergRESTCatalogClient(HiveConf conf, H Class handlerClass = (Class) Class.forName("org.apache.iceberg.hive.HiveIcebergRESTCatalogClientAdapter", true, Utilities.getSessionSpecifiedClassLoader()); - Class[] constructorArgTypes = new Class[] { Configuration.class, HiveMetaHookLoader.class}; - Object[] constructorArgs = new Object[] {conf, hookLoader}; + Class[] constructorArgTypes = new Class[] { Configuration.class}; + Object[] constructorArgs = new Object[] {conf}; IMetaStoreClient restCatalogMetastoreClient = JavaUtils.newInstance(handlerClass, constructorArgTypes, constructorArgs); restCatalogMetastoreClient.reconnect(); return restCatalogMetastoreClient; diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index 21e5bc2d390b..2aa63156bee4 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -1585,7 +1585,9 @@ default boolean listPartitionsByExpr(String catName, String db_name, String tbl_ * @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(PartitionsByExprRequest req, List result) throws TException; + default boolean listPartitionsByExpr(PartitionsByExprRequest req, List result) throws TException{ + throw new UnsupportedOperationException("this method is not supported"); + } /** * List partitions, fetching the authorization information along with the partitions. @@ -2301,9 +2303,11 @@ default List dropPartitions(String catName, String dbName, String tbl throw new UnsupportedOperationException("this method is not supported"); } - List dropPartitions(String catName, String dbName, String tblName, + default List dropPartitions(String catName, String dbName, String tblName, List> partExprs, PartitionDropOptions options, EnvironmentContext context) - throws NoSuchObjectException, MetaException, TException; + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition.