garyli1019 commented on a change in pull request #1810:
URL: https://github.com/apache/hudi/pull/1810#discussion_r455483211



##########
File path: hudi-spark/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala
##########
@@ -255,6 +262,43 @@ private[hudi] object HoodieSparkSqlWriter {
     hiveSyncConfig
   }
 
+  private def metaSync(parameters: Map[String, String],
+                       basePath: Path,
+                       hadoopConf: Configuration): Boolean = {
+    val hiveSyncEnabled = parameters.get(HIVE_SYNC_ENABLED_OPT_KEY).exists(r 
=> r.toBoolean)
+    var metaSyncEnabled = parameters.get(HUDI_SYNC_ENABLED_OPT_KEY).exists(r 
=> r.toBoolean)
+    var syncClientToolClass = parameters.get(SYNC_CLIENT_TOOL_CLASS).get
+    // for backward compatibility
+    if (hiveSyncEnabled) {
+      metaSyncEnabled = true
+      syncClientToolClass = DEFAULT_SYNC_CLIENT_TOOL_CLASS
+    }
+    var metaSyncSuccess = true
+    if (metaSyncEnabled) {
+      val impls = syncClientToolClass.split(",")
+      impls.foreach(impl => {
+        val syncSuccess = impl.trim match {
+          case DEFAULT_SYNC_CLIENT_TOOL_CLASS => {
+            log.info("Syncing to Hive Metastore (URL: " + 
parameters(HIVE_URL_OPT_KEY) + ")")
+            val fs = FSUtils.getFs(basePath.toString, hadoopConf)
+            syncHive(basePath, fs, parameters)
+          }
+          case _ => {
+            val fs = FSUtils.getFs(basePath.toString, hadoopConf)
+            val properties = new Properties();
+            properties.putAll(parameters)
+            properties.put("basePath", basePath.toString)
+            val syncHoodie = ReflectionUtils.loadClass(impl.trim, 
Array[Class[_]](classOf[Properties], classOf[FileSystem]), properties, 
fs).asInstanceOf[AbstractSyncTool]
+            syncHoodie.syncHoodieTable()

Review comment:
       Is there any concern that not using this way to `syncHive()`?




----------------------------------------------------------------
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]


Reply via email to