cnauroth commented on code in PR #5504: URL: https://github.com/apache/hive/pull/5504#discussion_r1950235033
########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java: ########## @@ -151,40 +145,24 @@ public FileSystem getFs(Path f) throws MetaException { * @return Path with canonical scheme and authority */ public static Path getDnsPath(Path path, Configuration conf) throws MetaException { - if (isBlobStorageScheme(conf, path.toUri().getScheme())) { - String scheme = path.toUri().getScheme(); - String authority = path.toUri().getAuthority(); - URI defaultUri = FileSystem.getDefaultUri(conf); - if ((authority == null && scheme == null) - || StringUtils.equalsIgnoreCase(scheme, defaultUri.getScheme())) { - if (authority == null) { - authority = defaultUri.getAuthority(); - } - if (scheme == null) { - scheme = defaultUri.getScheme(); - } - String uriPath = path.toUri().getPath(); - if (StringUtils.isEmpty(uriPath)) { - uriPath = "/"; - } - return new Path(scheme, authority, uriPath); + String scheme = path.toUri().getScheme(); + String authority = path.toUri().getAuthority(); + URI defaultUri = FileSystem.getDefaultUri(conf); + if ((authority == null && scheme == null) + || StringUtils.equalsIgnoreCase(scheme, defaultUri.getScheme())) { + if (authority == null) { + authority = defaultUri.getAuthority(); + } + if (scheme == null) { + scheme = defaultUri.getScheme(); } - return path; - } else { // fallback: for other FS type make the FS instance - FileSystem fs = getFs(path, conf); Review Comment: Agreed, the optimization seems good for all file systems. I think it's more impactful for blobstores like S3, where the bucket is part of the authority, and therefore different buckets mean different `FileSystem` instances. The optimization is still valid for HDFS though. -- 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