xuefuz commented on a change in pull request #8589: [FLINK-12677][hive][sql-client] Add descriptor, validator, and factory for HiveCatalog URL: https://github.com/apache/flink/pull/8589#discussion_r291770433
########## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java ########## @@ -114,46 +114,22 @@ private HiveMetastoreClientWrapper client; - public HiveCatalog(String catalogName, @Nullable String defaultDatabase, @Nullable String hiveSiteFilePath) { - this(catalogName, - defaultDatabase == null ? DEFAULT_DB : defaultDatabase, - getHiveConf(loadHiveSiteUrl(hiveSiteFilePath))); - } - public HiveCatalog(String catalogName, @Nullable String defaultDatabase, @Nullable URL hiveSiteUrl) { this(catalogName, defaultDatabase == null ? DEFAULT_DB : defaultDatabase, getHiveConf(hiveSiteUrl)); } - public HiveCatalog(String catalogName, @Nullable String defaultDatabase, @Nullable HiveConf hiveConf) { + @VisibleForTesting + protected HiveCatalog(String catalogName, String defaultDatabase, HiveConf hiveConf) { super(catalogName, defaultDatabase == null ? DEFAULT_DB : defaultDatabase); this.hiveConf = hiveConf == null ? getHiveConf(null) : hiveConf; LOG.info("Created HiveCatalog '{}'", catalogName); } - private static URL loadHiveSiteUrl(String filePath) { - - URL url = null; - - if (!StringUtils.isNullOrWhitespaceOnly(filePath)) { - try { - url = new File(filePath).toURI().toURL(); - - LOG.info("Successfully loaded '{}'", filePath); - - } catch (MalformedURLException e) { - throw new CatalogException( - String.format("Failed to get hive-site.xml from the given path '%s'", filePath), e); - } - } - - return url; - } - - private static HiveConf getHiveConf(URL hiveSiteUrl) { + public static HiveConf getHiveConf(URL hiveSiteUrl) { Review comment: 1. This doesn't seem needing to be public 2. Maybe rename it to createHiveConf. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services