You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/03/19 14:06:35 UTC
[GitHub] [flink] hehuiyuan commented on a change in pull request #15274: [FLINK-21829][Hive Connect]Fix to throw exception when custom hadoop conf path does not exist
hehuiyuan commented on a change in pull request #15274:
URL: https://github.com/apache/flink/pull/15274#discussion_r597705627
##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -217,12 +218,27 @@ private static HiveConf createHiveConf(
HadoopUtils.possibleHadoopConfPaths(
new org.apache.flink.configuration.Configuration())) {
hadoopConf = getHadoopConfiguration(possibleHadoopConfPath);
- if (hadoopConf != null) {
+ if (hadoopConf != null && hadoopConf.size() != 0) {
break;
}
}
} else {
hadoopConf = getHadoopConfiguration(hadoopConfDir);
+ if (hadoopConf == null) {
+ throw new CatalogException(
+ "Failed to load the hadoop conf from specified path:" + hadoopConfDir,
+ new FileNotFoundException("Path " + hadoopConfDir + " does not exist."));
+ }
+ if (hadoopConf.size() == 0) {
Review comment:
(1)The method `getHadoopConfiguration ` returns `hadoopConfiguration` that is not null when hadoop path exists but no conf files exist.
(2)The method `getHadoopConfiguration ` returns `hadoopConfiguration` that is null when hadoop path does not exist.
if hadoopConf == null , hadoop does not exist;
if hadoopConf != null but hadoopConf.size == 0 , hadoop path exists but no conf files.
--
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:
users@infra.apache.org