deniskuzZ commented on code in PR #4880:
URL: https://github.com/apache/hive/pull/4880#discussion_r1409214784


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1038,6 +1045,40 @@ static String encodeString(String rawString) {
     return 
HiveConf.EncoderDecoderFactory.URL_ENCODER_DECODER.encode(rawString);
   }
 
+  static String getPathForAuth(String locationProperty, String 
defaultTableLocation, Configuration conf) {

Review Comment:
   it looks much more complicated than initial commit. could we do something 
like this:
   ````
     private String getPathForAuth(String location) {
       return getPathForAuth(location, SessionStateUtil.getProperty(conf, 
hive_metastoreConstants.DEFAULT_TABLE_LOCATION).orElse(null));
     }
   
     private String getPathForAuth(String location, String defaultLocation) {
       boolean maskDefaultLocation = 
conf.getBoolean(HiveConf.ConfVars.HIVE_ICEBERG_MASK_DEFAULT_LOCATION.varname,
         HiveConf.ConfVars.HIVE_ICEBERG_MASK_DEFAULT_LOCATION.defaultBoolVal);
   
       if (!maskDefaultLocation || defaultLocation == null) {
         return encodeString(location);
       }
   
       try {
         Path locationPath = new Path(URI.create(location).getPath());
         Path defaultPath = locationPath.toUri().getScheme() != null ? 
             FileUtils.makeQualified(new Path(defaultLocation), conf) : 
Path.getPathWithoutSchemeAndAuthority(new Path(defaultLocation));
         
         return encodeString(
             location.replaceFirst(defaultPath.toString(), 
TABLE_DEFAULT_LOCATION));
       } catch (IOException e) {
         throw new RuntimeException(e);
       }
     }
   ````



-- 
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]

Reply via email to