pvary commented on code in PR #3226:
URL: https://github.com/apache/hive/pull/3226#discussion_r869971298
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -457,9 +459,24 @@ public boolean isValidMetadataTable(String metaTableName) {
public URI getURIForAuth(org.apache.hadoop.hive.metastore.api.Table
hmsTable) throws URISyntaxException {
String dbName = hmsTable.getDbName();
String tableName = hmsTable.getTableName();
- return new URI(ICEBERG_URI_PREFIX + dbName + "/" + tableName);
+ StringBuilder authURI = new
StringBuilder(ICEBERG_URI_PREFIX).append(dbName).append("/").append(tableName)
+ .append("?snapshot=");
+ Optional<String> locationProperty = SessionStateUtil.getProperty(conf,
hive_metastoreConstants.META_TABLE_LOCATION);
+ if (locationProperty.isPresent()) {
+ Preconditions.checkArgument(locationProperty.get() != null,
+ "Table location is not set " + "in SessionState. Authorization URI
cannot be supplied.");
+ // this property is set during the create operation before the hive
table was created
+ // we are returning a dummy iceberg metadata file
+
authURI.append(URI.create(locationProperty.get()).getPath()).append("/metadata/dummy.metadata.json");
+ return new
URI(HiveConf.EncoderDecoderFactory.URL_ENCODER_DECODER.encode(authURI.toString()));
+ }
Review Comment:
nit: maybe use an `else`? I usually try to avoid using return in the middle
of a method and using the return statement in place of else statements.
```
if () {
return...
} else {
return...
}
```
For me this is easier to read.
What do you think?
--
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]