deniskuzZ commented on code in PR #5343:
URL: https://github.com/apache/hive/pull/5343#discussion_r1816668348
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1107,11 +1109,21 @@ public URI
getURIForAuth(org.apache.hadoop.hive.metastore.api.Table hmsTable) th
// this property is set during the create operation before the hive
table was created
// we are returning a dummy iceberg metadata file
authURI.append(getPathForAuth(locationProperty.get()))
- .append(encodeString("/metadata/dummy.metadata.json"));
+ .append(encodeString(DUMMY_METADATA_JSON));
} else {
- Table table = IcebergTableUtil.getTable(conf, hmsTable);
- authURI.append(getPathForAuth(((BaseTable)
table).operations().current().metadataFileLocation(),
- hmsTable.getSd().getLocation()));
+ try {
+ Table table = IcebergTableUtil.getTable(conf, hmsTable);
+ authURI.append(getPathForAuth(((BaseTable)
table).operations().current().metadataFileLocation(),
+ hmsTable.getSd().getLocation()));
+ } catch (NoSuchTableException ex) {
+ if (hmsTable.getSd() != null &&
!hmsTable.getSd().getLocation().isEmpty()) {
+
authURI.append(encodeString(URI.create(hmsTable.getSd().getLocation()).getPath()))
Review Comment:
@DanielZhu58, can we refactor?
````
String location, defaultTableLocation=null;
try {
Table table = IcebergTableUtil.getTable(conf, hmsTable);
location = ((BaseTable)
table).operations().current().metadataFileLocation();
defaultTableLocation = hmsTable.getSd().getLocation();
} catch (NoSuchTableException ex) {
location = hmsTable.getSd().getLocation();
}
authURI.append(getPathForAuth(location, defaultTableLocation);
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]