You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by mb...@apache.org on 2022/02/23 09:56:46 UTC
[hive] branch master updated: HIVE-25964: Create iceberg table with ranger authorization failed with storage URI NullPointerException (#3038) (Butao Zhang, reviewed by Marton Bod)
This is an automated email from the ASF dual-hosted git repository.
mbod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 1c3ecf9 HIVE-25964: Create iceberg table with ranger authorization failed with storage URI NullPointerException (#3038) (Butao Zhang, reviewed by Marton Bod)
1c3ecf9 is described below
commit 1c3ecf95f94a0329626a9fe46670586e7767f014
Author: Butao Zhang <97...@users.noreply.github.com>
AuthorDate: Wed Feb 23 17:56:30 2022 +0800
HIVE-25964: Create iceberg table with ranger authorization failed with storage URI NullPointerException (#3038) (Butao Zhang, reviewed by Marton Bod)
---
.../iceberg/mr/hive/HiveIcebergStorageHandler.java | 5 +++--
.../org/apache/iceberg/mr/hive/IcebergTableUtil.java | 20 --------------------
.../mr/hive/TestHiveIcebergStorageHandlerNoScan.java | 4 ++--
3 files changed, 5 insertions(+), 24 deletions(-)
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 aec235a..2dd92a3 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
@@ -369,8 +369,9 @@ public class HiveIcebergStorageHandler implements HiveStoragePredicateHandler, H
@Override
public URI getURIForAuth(org.apache.hadoop.hive.metastore.api.Table hmsTable) throws URISyntaxException {
- Table table = IcebergTableUtil.getTable(conf, hmsTable);
- return new URI(ICEBERG_URI_PREFIX + table.location());
+ String dbName = hmsTable.getDbName();
+ String tableName = hmsTable.getTableName();
+ return new URI(ICEBERG_URI_PREFIX + dbName + "/" + tableName);
}
@Override
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 63ddfc3..a0c46c6 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
@@ -30,10 +30,8 @@ import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Table;
import org.apache.iceberg.UpdatePartitionSpec;
-import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.mr.Catalogs;
-import org.apache.iceberg.mr.InputFormatConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,24 +70,6 @@ public class IcebergTableUtil {
}
/**
- * Constructs the table properties needed for the Iceberg table loading by retrieving the information from the
- * hmsTable. It then calls {@link IcebergTableUtil#getTable(Configuration, Properties)} with these properties.
- * @param configuration a Hadoop configuration
- * @param hmsTable the HMS table
- * @return the Iceberg table
- */
- static Table getTable(Configuration configuration, org.apache.hadoop.hive.metastore.api.Table hmsTable) {
- Properties properties = new Properties();
- properties.setProperty(Catalogs.NAME, TableIdentifier.of(hmsTable.getDbName(), hmsTable.getTableName()).toString());
- properties.setProperty(Catalogs.LOCATION, hmsTable.getSd().getLocation());
- if (hmsTable.getParameters().containsKey(InputFormatConfig.CATALOG_NAME)) {
- properties.setProperty(
- InputFormatConfig.CATALOG_NAME, hmsTable.getParameters().get(InputFormatConfig.CATALOG_NAME));
- }
- return getTable(configuration, properties);
- }
-
- /**
* Create {@link PartitionSpec} based on the partition information stored in
* {@link PartitionTransformSpec}.
* @param configuration a Hadoop configuration
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
index 136ad4f..edaf123 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
@@ -1346,7 +1346,7 @@ public class TestHiveIcebergStorageHandlerNoScan {
@Test
public void testAuthzURI() throws TException, InterruptedException, URISyntaxException {
TableIdentifier target = TableIdentifier.of("default", "target");
- Table table = testTables.createTable(shell, target.name(), HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+ testTables.createTable(shell, target.name(), HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
PartitionSpec.unpartitioned(), FileFormat.PARQUET, ImmutableList.of());
org.apache.hadoop.hive.metastore.api.Table hmsTable = shell.metastore().getTable(target);
@@ -1354,7 +1354,7 @@ public class TestHiveIcebergStorageHandlerNoScan {
storageHandler.setConf(shell.getHiveConf());
URI uriForAuth = storageHandler.getURIForAuth(hmsTable);
- Assert.assertEquals("iceberg://" + table.location(), uriForAuth.toString());
+ Assert.assertEquals("iceberg://" + hmsTable.getDbName() + "/" + hmsTable.getTableName(), uriForAuth.toString());
}
/**