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/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..3da6b7cce918 --- /dev/null +++ b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveIcebergRESTCatalogClientAdapter.java @@ -0,0 +1,314 @@ +/* + * 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.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.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.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; +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.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 extends BaseMetaStoreClient { + + 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 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.rest-catalog."; + public static final String WAREHOUSE = "warehouse"; + private final Configuration conf; + private RESTCatalog restCatalog; + + private final long maxHiveTablePropertySize; + + public HiveIcebergRESTCatalogClientAdapter(Configuration conf) { + super(conf); + this.conf = conf; + this.maxHiveTablePropertySize = conf.getLong(HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE, + HiveOperationsBase.HIVE_TABLE_PROPERTY_MAX_SIZE_DEFAULT); + } + + @Override + public void reconnect() { + Map properties = getCatalogPropertiesFromConf(conf); + String catalogName = properties.get(WAREHOUSE); + restCatalog = new RESTCatalog(); + restCatalog.initialize(catalogName, properties); + } + + @Override + public void close() { + try { + if (restCatalog != null) { + restCatalog.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static Map getCatalogPropertiesFromConf( + Configuration conf) { + Map catalogProperties = Maps.newHashMap(); + conf.forEach(config -> { + if (config.getKey().startsWith(CATALOG_CONFIG_PREFIX)) { + catalogProperties.put( + config.getKey().substring(CATALOG_CONFIG_PREFIX.length()), + config.getValue()); + } + }); + return catalogProperties; + } + + + @Override + public List getDatabases(String catName, String databasePattern) 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 catName, String dbName, String tablePattern) + throws MetaException, TException, UnknownDBException { + return getTables(catName, dbName, tablePattern, null); + } + + @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 catName, String dbName) throws MetaException, TException, UnknownDBException { + return getTables(catName, dbName, "", null); + } + + @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 boolean tableExists(String catName, String dbName, String tableName) + throws MetaException, TException, UnknownDBException { + return tableExists(dbName, tableName); + } + + @Override + 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(); + 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(); + } + + 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(ICEBERG_CATALOG_TYPE, 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(GetTableRequest getTableRequest) throws MetaException, TException, NoSuchObjectException { + 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; + } + + @Override + public void createTable(CreateTableRequest request) + throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException { + 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(table); + Schema schema = HiveSchemaUtil.convert(cols, true); + SortOrder sortOrder = HMSTablePropertyHelper.getSortOrder(catalogProperties, schema); + org.apache.iceberg.PartitionSpec partitionSpec = HMSTablePropertyHelper.createPartitionSpec(this.conf, schema); + restCatalog + .buildTable(TableIdentifier.of(table.getDbName(), table.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(); + } + + @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(DropDatabaseRequest req) throws TException { + restCatalog.dropNamespace(Namespace.of(req.getName())); + } + + @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..877122a1aedd --- /dev/null +++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveIcebergRESTCatalogClientAdapter.java @@ -0,0 +1,186 @@ +/* + * 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.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); + hiveIcebergRESTCatalogClientAdapter = Mockito.spy(new HiveIcebergRESTCatalogClientAdapter(configuration)); + 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..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 @@ -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. @@ -73,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); @@ -144,7 +144,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 +156,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 +221,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); } @@ -263,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(catalogName) ? + InputFormatConfig.CATALOG_REST_CONFIG_PREFIX : InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName; conf.forEach(config -> { if (config.getKey().startsWith(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX)) { catalogProperties.putIfAbsent( @@ -275,7 +270,9 @@ private static Map getCatalogProperties(Configuration conf, Stri config.getValue()); } }); - + if (REST_CATALOG_TYPE.equals(catalogName)) { + catalogProperties.put("type", "rest"); + } return catalogProperties; } @@ -298,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/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/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..03dda9fa9e88 --- /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 CONNECTOR_NAME = "iceberg"; + + public static IMetaStoreClient create(HiveConf hiveConf, boolean allowEmbedded, + ConcurrentHashMap metaCallTimeMap, HiveMetaHookLoader hookLoader) throws MetaException { + + 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); + 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 getHiveIcebergRESTCatalogClient(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}; + Object[] constructorArgs = new Object[] {conf}; + 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..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 @@ -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,26 @@ 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) { + throw new UnsupportedOperationException("this method is not supported"); + }; /** * Returns true if the current client is using an in process metastore (local metastore). * * @return */ - boolean isLocalMetaStore(); + default boolean isLocalMetaStore(){ + throw new UnsupportedOperationException("this method is not supported"); + } /** * Tries to reconnect this MetaStoreClient to the MetaStore. @@ -79,12 +89,16 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 +109,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter an existing catalog. @@ -110,8 +126,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a catalog object. @@ -121,7 +139,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of all catalogs known to the system. @@ -129,7 +149,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a catalog. Catalogs must be empty to be dropped, there is no cascade for dropping a @@ -140,8 +162,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a catalog. Catalogs must be empty to be dropped, there is no cascade for dropping a @@ -150,7 +174,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the names of all databases in the default catalog that match the given pattern. @@ -253,8 +279,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the names of all the tables along with extended table metadata @@ -267,8 +295,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get materialized views that have rewriting enabled. This will use the default catalog. @@ -278,8 +308,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get materialized views that have rewriting enabled. @@ -290,8 +322,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetches just table name and comments. Useful when you need full table name @@ -305,8 +339,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetches just table name and comments. Useful when you need full table name @@ -321,9 +357,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the names of all tables in the specified database. @@ -386,8 +424,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of table names that match a filter. @@ -429,8 +469,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop the table. @@ -566,18 +608,29 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } + + default void truncateTable(TableName table, List partNames) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void truncateTable(TableName table, List partNames) throws TException; + default void truncateTable(String dbName, String tableName, List partNames, + String validWriteIds, long writeId) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + }; - 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 { + 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. @@ -586,7 +639,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Check whether a table exists in the default catalog. @@ -742,8 +797,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get tables as objects (rather than just fetching their names). This is more expensive and @@ -765,8 +822,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 +847,34 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** /** @@ -822,8 +889,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -838,8 +907,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -853,8 +924,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a partition to a table and get back the resulting Partition object. This creates an @@ -869,8 +942,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a partition to the table. @@ -887,8 +962,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add partitions to the table. @@ -904,8 +981,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a partitions using a spec proxy. @@ -916,8 +995,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add partitions to the table. @@ -927,9 +1008,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a partition. @@ -942,8 +1025,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a partition. @@ -953,8 +1038,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a partition. @@ -968,8 +1055,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Move a partition from one table to another @@ -984,10 +1073,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Move a partition from one table to another @@ -1004,10 +1095,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * With the one partitionSpecs to exchange, multiple partitions could be exchanged. @@ -1024,10 +1117,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * With the one partitionSpecs to exchange, multiple partitions could be exchanged. @@ -1046,10 +1141,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a Partition by name. @@ -1060,8 +1157,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a Partition by name. @@ -1073,8 +1172,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** @@ -1090,9 +1191,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a Partition along with authorization information. @@ -1108,9 +1211,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partittions for a table. @@ -1122,8 +1227,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partittions for a table. @@ -1136,8 +1243,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions from a table, returned in the form of PartitionSpecProxy @@ -1147,8 +1256,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions from a table, returned in the form of PartitionSpecProxy @@ -1159,8 +1270,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions based on a (possibly partial) list of partition values. @@ -1174,8 +1287,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions based on a (possibly partial) list of partition values. @@ -1190,9 +1305,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List Names of partitions in a table. @@ -1204,8 +1321,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List Names of partitions in a table. @@ -1215,8 +1334,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List Names of partitions in a table. @@ -1229,8 +1350,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partition names matching a partial specification of the partition values. @@ -1246,9 +1369,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partition names matching a partial specification of the partition values. @@ -1265,9 +1389,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partition names matching the specified filter and return in order if specified. @@ -1277,8 +1402,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partition values @@ -1288,8 +1415,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get number of partitions matching specified filter @@ -1303,8 +1432,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get number of partitions matching specified filter @@ -1319,8 +1450,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** @@ -1337,8 +1470,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get list of partitions matching specified filter @@ -1355,9 +1490,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to @@ -1371,9 +1508,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of partitions in a PartitionSpec, using a filter to select which partitions to @@ -1388,9 +1526,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get list of {@link PartitionSpec} matching specified serialized expression. @@ -1398,8 +1537,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get list of partitions matching specified serialized expression @@ -1414,9 +1554,11 @@ boolean listPartitionsSpecByExpr(PartitionsByExprRequest req, List result) - throws TException; + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get list of partitions matching specified serialized expression @@ -1432,9 +1574,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get list of partitions matching specified serialized expression @@ -1442,7 +1585,9 @@ boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, by * @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. @@ -1456,9 +1601,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List partitions, fetching the authorization information along with the partitions. @@ -1468,8 +1615,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List partitions, fetching the authorization information along with the partitions. @@ -1484,9 +1633,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get partitions by a list of partition names. @@ -1500,8 +1651,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get partitions by a list of partition names. @@ -1511,8 +1664,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get partitions by a list of partition names. @@ -1522,7 +1677,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List partitions along with privilege information for a user or groups @@ -1537,9 +1694,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * List partitions along with privilege information for a user or groups @@ -1554,10 +1713,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark an event as having occurred on a partition. @@ -1573,9 +1733,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark an event as having occurred on a partition. @@ -1592,9 +1754,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Determine whether a partition has been marked with a particular event type. @@ -1610,9 +1774,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Determine whether a partition has been marked with a particular event type. @@ -1629,16 +1795,20 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param partVals * @throws TException * @throws MetaException */ - 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 @@ -1647,8 +1817,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 +1855,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a table. Equivalent to @@ -1718,17 +1892,21 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a table. @@ -1743,13 +1921,15 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 +2024,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a database. @@ -1857,8 +2039,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create a new dataconnector. @@ -1868,8 +2052,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a dataconnector. @@ -1881,8 +2067,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a dataconnector. @@ -1892,8 +2080,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the dataconnector by name @@ -1901,8 +2091,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the names of all dataconnectors in the MetaStore. @@ -1910,7 +2102,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition. @@ -1924,9 +2118,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition. @@ -1941,9 +2137,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition with the option to purge the partition data directly, @@ -1957,9 +2155,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition with the option to purge the partition data directly, @@ -1974,9 +2174,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop partitions based on an expression. @@ -1994,9 +2196,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop partitions based on an expression. @@ -2024,9 +2228,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 +2277,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Generalization of dropPartitions(), @@ -2083,14 +2296,18 @@ 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 { + 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. @@ -2103,9 +2320,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a partition. @@ -2119,9 +2338,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a partition to new partition @@ -2139,8 +2360,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a partition to new partition @@ -2159,13 +2382,17 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a partition to new partition @@ -2183,9 +2410,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2204,8 +2433,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2225,14 +2456,18 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * updates a list of partitions @@ -2251,10 +2486,12 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * rename a partition to a new partition @@ -2275,9 +2512,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * rename a partition to a new partition @@ -2303,9 +2542,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, excluding the partition columns. @@ -2317,9 +2558,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, excluding the partition columns. @@ -2332,9 +2575,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, excluding the partition columns. @@ -2345,9 +2590,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, including the partition columns. @@ -2359,9 +2606,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, including the partition columns. @@ -2374,9 +2623,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get schema for a table, including the partition columns. @@ -2387,9 +2638,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param name @@ -2400,8 +2653,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 +2666,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * * @param name @@ -2421,8 +2678,10 @@ List partitionNameToVals(String name) * @throws MetaException * @throws TException */ - Map partitionNameToSpec(String name) - throws MetaException, TException; + default Map partitionNameToSpec(String name) + throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Write table level column statistics to persistent store @@ -2434,9 +2693,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 { + throw new UnsupportedOperationException("this method is not supported"); +} /** * Write partition level column statistics to persistent store @@ -2448,9 +2709,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the column statistics for a set of columns in a table. This should only be used for @@ -2465,12 +2728,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the column statistics for a set of columns in a table. This should only be used for @@ -2486,12 +2753,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the column statistics for a set of columns in a partition. * @param dbName database name @@ -2505,14 +2776,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the column statistics for a set of columns in a partition. @@ -2528,16 +2803,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Delete partition level column statistics given dbName, tableName, partName and colName, or * all columns in a partition. @@ -2672,9 +2950,13 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException; + default void updateTransactionalStatistics(UpdateTransactionalStatsRequest req) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param role @@ -2683,8 +2965,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param role_name @@ -2694,7 +2978,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * list all role names @@ -2702,7 +2988,9 @@ boolean create_role(Role role) * @throws TException * @throws MetaException */ - List listRoleNames() throws MetaException, TException; + default List listRoleNames() throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @@ -2716,9 +3004,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param role_name @@ -2731,8 +3021,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @@ -2742,8 +3034,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Return the privileges that the user, group have directly and indirectly through roles @@ -2755,9 +3049,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Return the privileges that this principal has directly over the object (not through roles). @@ -2768,9 +3064,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param privileges @@ -2778,8 +3076,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param privileges @@ -2787,8 +3087,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param authorizer @@ -2797,8 +3099,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * This is expected to be a no-op when in local mode, @@ -2809,8 +3113,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param tokenStrForm @@ -2818,33 +3124,56 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * @param tokenStrForm * @throws MetaException * @throws TException */ - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - String getTokenStrForm() throws IOException; + default boolean addToken(String tokenIdentifier, String delegationToken) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - boolean addToken(String tokenIdentifier, String delegationToken) throws TException; + default boolean removeToken(String tokenIdentifier) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - boolean removeToken(String tokenIdentifier) throws TException; + default String getToken(String tokenIdentifier) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - String getToken(String tokenIdentifier) throws TException; + default List getAllTokenIdentifiers() throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - List getAllTokenIdentifiers() throws TException; + default int addMasterKey(String key) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - int addMasterKey(String key) throws MetaException, TException; + default void updateMasterKey(Integer seqNo, String key) + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void updateMasterKey(Integer seqNo, String key) - throws NoSuchObjectException, MetaException, TException; + default boolean removeMasterKey(Integer keySeq) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - boolean removeMasterKey(Integer keySeq) throws TException; - String[] getMasterKeys() throws TException; + default String[] getMasterKeys() throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create a new function. @@ -2853,8 +3182,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a function. @@ -2865,8 +3196,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter a function. @@ -2878,8 +3211,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a function. @@ -2891,8 +3226,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a function. @@ -2905,8 +3242,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a function. @@ -2915,8 +3254,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a function. @@ -2926,8 +3267,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get all functions matching a pattern @@ -2937,16 +3280,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get all functions matching a pattern * @param catName catalog name. @@ -2956,8 +3303,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get all functions in the default catalog. @@ -2965,16 +3314,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid transactions. * @return list of valid transactions * @throws TException */ - ValidTxnList getValidTxns() throws TException; + default ValidTxnList getValidTxns() throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid transactions. @@ -2983,7 +3338,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid transactions. @@ -2993,7 +3350,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid write ids. @@ -3001,7 +3360,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid write ids. @@ -3010,7 +3371,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a structure that details valid write ids list for all tables read by current txn. @@ -3020,15 +3383,19 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Initiate a transaction. @@ -3038,7 +3405,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Initiate a transaction with given type. @@ -3047,7 +3416,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Initiate a repl replayed or hive replication transaction (dump/load). @@ -3062,7 +3433,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Initiate a batch of transactions. It is not guaranteed that the @@ -3089,7 +3462,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Rollback a transaction. This will also unlock any locks associated with @@ -3100,7 +3475,9 @@ List getValidWriteIds(List tablesList, String validT * deleted. * @throws TException */ - 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 @@ -3112,7 +3489,9 @@ List getValidWriteIds(List tablesList, String validT * deleted. * @throws TException */ - 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 @@ -3128,7 +3507,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Commit a transaction. This will also unlock any locks associated with @@ -3141,8 +3522,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Like commitTxn but it will atomically store as well a key and a value. This @@ -3166,9 +3549,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Commit a transaction. This will also unlock any locks associated with @@ -3182,14 +3567,18 @@ 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 { + 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 */ - 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 @@ -3197,7 +3586,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3206,7 +3597,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3216,7 +3609,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Replicate Table Write Ids state to mark aborted write ids and writeid high water mark. @@ -3226,8 +3621,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. @@ -3236,7 +3633,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Allocate a per table write ID and associate it with the given transaction. Used by replication load task. @@ -3246,8 +3645,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the maximum allocated writeId for the given table @@ -3256,7 +3657,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Seed an ACID table with the given writeId. If the table already contains writes it will fail. @@ -3265,7 +3668,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Seed or increment the global txnId to the given value. @@ -3273,7 +3678,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Show the list of currently open transactions. This is for use by "show transactions" in the @@ -3282,7 +3689,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Request a set of locks. All locks needed for a particular query, DML, @@ -3313,8 +3722,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Check the status of a set of locks requested via a @@ -3337,9 +3748,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Unlock a set of locks. This can only be called when the locks are not @@ -3352,8 +3765,10 @@ LockResponse checkLock(long lockid) * transaction. * @throws TException */ - void unlock(long lockid) - throws NoSuchLockException, TxnOpenException, TException; + default void unlock(long lockid) + throws NoSuchLockException, TxnOpenException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Show all currently held and waiting locks. @@ -3361,7 +3776,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Send a heartbeat to indicate that the client holding these locks (if @@ -3383,9 +3800,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Send heartbeats for a range of transactions. This is for the streaming ingest client that @@ -3397,7 +3816,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Send a request to compact a table or partition. This will not block until the compaction is @@ -3409,7 +3830,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of all compactions. @@ -3417,12 +3840,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a list of compactions for the given request object. */ - ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException; + default ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Submit a request for performing cleanup of output directory. This is particularly @@ -3434,8 +3861,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get one latest record of SUCCEEDED or READY_FOR_CLEANING compaction for a table/partition. @@ -3448,8 +3877,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Send a list of partitions to the metastore to indicate which partitions were loaded @@ -3461,9 +3892,11 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Performs the commit/rollback to the metadata storage for insert operator from external storage handler. @@ -3472,16 +3905,22 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - GetDatabaseObjectsResponse get_databases_req(GetDatabaseObjectsRequest request) throws TException; + default GetDatabaseObjectsResponse get_databases_req(GetDatabaseObjectsRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * A filter provided by the client that determines if a given notification event should be @@ -3510,8 +3949,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 +3972,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the last used notification event id. @@ -3540,7 +3983,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 +3993,10 @@ NotificationEventResponse getNextNotification(NotificationEventRequest request, * @throws TException */ @InterfaceAudience.LimitedPrivate({"HCatalog"}) - NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) - throws TException; + default NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCountRequest rqst) + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Request that the metastore fire an event. Currently this is only supported for DML @@ -3560,7 +4007,9 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - FireEventResponse fireListenerEvent(FireEventRequest request) throws TException; + default FireEventResponse fireListenerEvent(FireEventRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a event related to write operations in an ACID table. @@ -3568,7 +4017,9 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - 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. @@ -3576,7 +4027,9 @@ NotificationEventsCountResponse getNotificationEventsCount(NotificationEventsCou * @throws TException */ @InterfaceAudience.LimitedPrivate({"Apache Hive, HCatalog"}) - 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) { @@ -3593,8 +4046,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 { + throw new UnsupportedOperationException("this method is not supported"); + } + /** * get all role-grants for roles that have been granted to given principal @@ -3605,8 +4061,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get aggregated column stats for a set of partitions. @@ -3620,12 +4078,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get aggregated column stats for a set of partitions. @@ -3640,15 +4102,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Set table or partition column statistics. * @param request request object, contains all the table, partition, and statistics information @@ -3659,38 +4125,52 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - Iterable> getFileMetadataBySarg( - List fileIds, ByteBuffer sarg, boolean doGetFooters) throws TException; + default Iterable> getFileMetadataBySarg( + List fileIds, ByteBuffer sarg, boolean doGetFooters) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Cleares the file metadata cache for respective file IDs. */ - 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. */ - 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"); + } - boolean isSameConfObj(Configuration c); + default boolean isSameConfObj(Configuration c) { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a primary key for a table. @@ -3700,8 +4180,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a foreign key for a table. @@ -3711,8 +4193,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a unique constraint for a table. @@ -3722,8 +4206,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a not null constraint for a table. @@ -3733,14 +4219,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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 +4242,21 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -3772,8 +4268,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a constraint. This can be used for primary keys, foreign keys, unique constraints, or @@ -3786,8 +4284,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** @@ -3797,8 +4297,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a foreign key @@ -3807,8 +4309,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a unique constraint @@ -3817,8 +4321,10 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a not null constraint @@ -3828,14 +4334,20 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - void addDefaultConstraint(List defaultConstraints) throws - MetaException, NoSuchObjectException, TException; + default void addDefaultConstraint(List defaultConstraints) throws + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void addCheckConstraint(List checkConstraints) throws - MetaException, NoSuchObjectException, TException; + default void addCheckConstraint(List checkConstraints) throws + MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Gets the unique id of the backing database instance used for storing metadata @@ -3843,59 +4355,95 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - void createResourcePlan(WMResourcePlan resourcePlan, String copyFromName) - throws InvalidObjectException, MetaException, TException; + default void createResourcePlan(WMResourcePlan resourcePlan, String copyFromName) + 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"); + } - List getAllResourcePlans(String ns) - throws NoSuchObjectException, MetaException, TException; + default List getAllResourcePlans(String ns) + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void dropResourcePlan(String resourcePlanName, String ns) - throws NoSuchObjectException, MetaException, TException; + default void dropResourcePlan(String resourcePlanName, String ns) + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - void createWMTrigger(WMTrigger trigger) - throws InvalidObjectException, MetaException, TException; + default void createWMTrigger(WMTrigger trigger) + throws InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void alterWMTrigger(WMTrigger trigger) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default void alterWMTrigger(WMTrigger trigger) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } - List getTriggersForResourcePlan(String resourcePlan, String ns) - throws NoSuchObjectException, MetaException, TException; + default List getTriggersForResourcePlan(String resourcePlan, String ns) + throws NoSuchObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void createWMPool(WMPool pool) - throws NoSuchObjectException, InvalidObjectException, MetaException, TException; + default void createWMPool(WMPool pool) + throws NoSuchObjectException, InvalidObjectException, MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void alterWMPool(WMNullablePool pool, String poolPath) - throws NoSuchObjectException, InvalidObjectException, TException; + default void alterWMPool(WMNullablePool pool, String poolPath) + throws NoSuchObjectException, InvalidObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void dropWMPool(String resourcePlanName, String poolPath, String ns) - throws TException; + default void dropWMPool(String resourcePlanName, String poolPath, String ns) + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void createOrUpdateWMMapping(WMMapping mapping, boolean isUpdate) - throws TException; + default void createOrUpdateWMMapping(WMMapping mapping, boolean isUpdate) + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - void dropWMMapping(WMMapping mapping) - throws TException; + default void dropWMMapping(WMMapping mapping) + throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create a new schema. This is really a schema container, as there will be specific versions @@ -3906,7 +4454,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Alter an existing schema. @@ -3918,7 +4468,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetch a schema. @@ -3930,7 +4482,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop an existing schema. If there are schema versions of this, this call will fail. @@ -3942,7 +4496,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a new version to an existing schema. @@ -3952,7 +4508,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get a specific version of a schema. @@ -3964,7 +4522,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the latest version of a schema. @@ -3977,7 +4538,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get all the extant versions of a schema. @@ -3990,7 +4553,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Drop a version of a schema. Given that versions are supposed to be immutable you should @@ -4004,7 +4569,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Find all schema versions that have columns that match a query. @@ -4014,7 +4581,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Map a schema version to a serde. This mapping is one-to-one, thus this will destroy any @@ -4029,7 +4598,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Set the state of a schema version. @@ -4043,7 +4614,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Add a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4053,7 +4626,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Fetch a serde. This is primarily intended for use with SchemaRegistry objects, since serdes @@ -4064,7 +4639,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Acquire the materialization rebuild lock for a given view. We need to specify the fully @@ -4076,7 +4653,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 { + throw new UnsupportedOperationException("this method is not supported"); + } + /** * Method to refresh the acquisition of a given materialization rebuild lock. @@ -4085,13 +4665,19 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** Adds a RuntimeStat for metastore persistence. */ - void addRuntimeStat(RuntimeStat stat) throws TException; + default void addRuntimeStat(RuntimeStat stat) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** Reads runtime statistics. */ - List getRuntimeStats(int maxWeight, int maxCreateTime) throws TException; + default List getRuntimeStats(int maxWeight, int maxCreateTime) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Generic Partition request API, providing different ways of filtering and controlling output. @@ -4109,7 +4695,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get the next compaction job to do. @@ -4118,7 +4706,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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Set the compaction highest write id. @@ -4126,7 +4716,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Get columns. @@ -4134,7 +4726,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @return * @throws TException */ - List findColumnsWithStats(CompactionInfoStruct cr) throws TException; + default List findColumnsWithStats(CompactionInfoStruct cr) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a finished compaction as cleaned. @@ -4142,7 +4736,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a finished compaction as compacted. @@ -4150,7 +4746,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a finished compaction as failed. @@ -4158,7 +4756,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Mark a compaction as refused (to run). @@ -4166,7 +4766,9 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Create, update or delete one record in the compaction metrics cache. @@ -4185,7 +4787,9 @@ void createOrDropTriggerToPoolMapping(String resourcePlanName, String triggerNam * @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"); + } /** @@ -4194,7 +4798,9 @@ 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 { + 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. @@ -4202,72 +4808,108 @@ 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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 { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Carries out maintenance of scheduled queries (insert/update/drop). */ - 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. * * @return optionally a scheduled query to be processed. */ - ScheduledQueryPollResponse scheduledQueryPoll(ScheduledQueryPollRequest request) throws MetaException, TException; + default ScheduledQueryPollResponse scheduledQueryPoll(ScheduledQueryPollRequest request) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * Registers the progress a scheduled query being executed. */ - 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 */ - void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException; + default void addReplicationMetrics(ReplicationMetricList replicationMetricList) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest - replicationMetricsRequest) throws MetaException, TException; + default ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest + replicationMetricsRequest) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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"); + } - StoredProcedure getStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException; + default StoredProcedure getStoredProcedure(StoredProcedureRequest request) throws MetaException, NoSuchObjectException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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"); + } - List getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException; + default List getAllStoredProcedures(ListStoredProcedureRequest request) throws MetaException, TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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"); + } - Package findPackage(GetPackageRequest request) throws TException; + default Package findPackage(GetPackageRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - List listPackages(ListPackageRequest request) throws TException; + default List listPackages(ListPackageRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - 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 */ - List getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException; + default List getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } - AbortCompactResponse abortCompactions(AbortCompactionRequest request) throws TException; + default AbortCompactResponse abortCompactions(AbortCompactionRequest request) throws TException { + throw new UnsupportedOperationException("this method is not supported"); + } /** * 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