yihua commented on a change in pull request #4458:
URL: https://github.com/apache/hudi/pull/4458#discussion_r780742608
##########
File path:
hudi-kafka-connect/src/main/java/org/apache/hudi/connect/writers/KafkaConnectTransactionServices.java
##########
@@ -185,20 +187,50 @@ private void syncMeta() {
}
private void syncHive() {
- HiveSyncConfig hiveSyncConfig = DataSourceUtils.buildHiveSyncConfig(
- new TypedProperties(connectConfigs.getProps()),
- tableBasePath,
- "PARQUET");
+ HiveSyncConfig hiveSyncConfig = buildSyncConfig(new
TypedProperties(connectConfigs.getProps()), tableBasePath);
+ String url;
+ if (!StringUtils.isNullOrEmpty(hiveSyncConfig.syncMode) &&
HiveSyncMode.of(hiveSyncConfig.syncMode) == HiveSyncMode.HMS) {
+ url = hadoopConf.get(KafkaConnectConfigs.HIVE_METASTORE_URIS);
+ } else {
+ url = hiveSyncConfig.jdbcUrl;
+ }
+
LOG.info("Syncing target hoodie table with hive table("
+ hiveSyncConfig.tableName
+ "). Hive metastore URL :"
- + hiveSyncConfig.jdbcUrl
+ + url
+ ", basePath :" + tableBasePath);
- LOG.info("Hive Sync Conf => " + hiveSyncConfig.toString());
+ LOG.info("Hive Sync Conf => " + hiveSyncConfig);
FileSystem fs = FSUtils.getFs(tableBasePath, hadoopConf);
HiveConf hiveConf = new HiveConf();
hiveConf.addResource(fs.getConf());
LOG.info("Hive Conf => " + hiveConf.getAllProperties().toString());
new HiveSyncTool(hiveSyncConfig, hiveConf, fs).syncHoodieTable();
}
+
+ /**
+ * Build Hive Sync Config
+ */
+ public HiveSyncConfig buildSyncConfig(TypedProperties props, String
tableBasePath) {
Review comment:
@cdmikechen Understood. I'm thinking about only moving util methods
related Hive sync configs, not the Hive sync logic, to a separate Util class.
The worry I have is that hive sync configs are spread into different places now
and they may diverge if we forget to update all of them to be consistent.
We can keep this PR as is for now. @cdmikechen could you create a Jira
ticket to track the Hive sync config unification, which will be done in a
different PR in future?
--
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]