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, defaultLocation = null; try { Table table = IcebergTableUtil.getTable(conf, hmsTable); location = ((BaseTable) table).operations().current().metadataFileLocation(); defaultLocation = hmsTable.getSd().getLocation(); } catch (NoSuchTableException ex) { if (hmsTable.getSd() != null && !hmsTable.getSd().getLocation().isEmpty()) { location = hmsTable.getSd().getLocation(); } else { throw new URISyntaxException... } } authURI.append(getPathForAuth(location, defaultLocation); ```` -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org