bowenli86 commented on a change in pull request #8616: [FLINK-12718][hive]
allow users to specify hive-site.xml location to configure hive metastore
client in HiveCatalog
URL: https://github.com/apache/flink/pull/8616#discussion_r291367510
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -109,27 +114,51 @@
private HiveMetastoreClientWrapper client;
- public HiveCatalog(String catalogName, String hivemetastoreURI) {
- this(catalogName, DEFAULT_DB, getHiveConf(hivemetastoreURI));
+ public HiveCatalog(String catalogName, @Nullable String
defaultDatabase, @Nullable String hiveSiteFilePath) {
+ this(catalogName,
+ defaultDatabase == null ? DEFAULT_DB : defaultDatabase,
+ getHiveConf(hiveSiteFilePath));
}
- public HiveCatalog(String catalogName, HiveConf hiveConf) {
- this(catalogName, DEFAULT_DB, hiveConf);
+ public HiveCatalog(String catalogName, @Nullable String
defaultDatabase, @Nullable URL hiveSiteUrl) {
+ this(catalogName,
+ defaultDatabase == null ? DEFAULT_DB : defaultDatabase,
+ getHiveConf(hiveSiteUrl));
}
- public HiveCatalog(String catalogName, String defaultDatabase, HiveConf
hiveConf) {
- super(catalogName, defaultDatabase);
- this.hiveConf = checkNotNull(hiveConf, "hiveConf cannot be
null");
+ public HiveCatalog(String catalogName, @Nullable String
defaultDatabase, @Nullable HiveConf hiveConf) {
+ super(catalogName, defaultDatabase == null ? DEFAULT_DB :
defaultDatabase);
+
+ this.hiveConf = hiveConf == null ? getHiveConf("") : hiveConf;
LOG.info("Created HiveCatalog '{}'", catalogName);
}
- private static HiveConf getHiveConf(String hiveMetastoreURI) {
-
checkArgument(!StringUtils.isNullOrWhitespaceOnly(hiveMetastoreURI),
"hiveMetastoreURI cannot be null or empty");
+ private static HiveConf getHiveConf(String filePath) {
Review comment:
make sense to me. changed.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services