pengzhiwei2018 commented on a change in pull request #2651:
URL: https://github.com/apache/hudi/pull/2651#discussion_r605337987



##########
File path: 
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala
##########
@@ -81,4 +82,53 @@ object HoodieWriterUtils {
     params.foreach(kv => props.setProperty(kv._1, kv._2))
     props
   }
+
+  /**
+   * Get the partition columns to stored to hoodie.properties.
+   * @param parameters
+   * @return
+   */
+  def getPartitionColumns(parameters: Map[String, String]): Option[String] = {
+    val  keyGenClass = parameters.getOrElse(KEYGENERATOR_CLASS_OPT_KEY,
+      DEFAULT_KEYGENERATOR_CLASS_OPT_VAL)
+    try {
+      val constructor = getClass.getClassLoader.loadClass(keyGenClass)
+        .getConstructor(classOf[TypedProperties])
+      constructor.setAccessible(true)
+      val props = new TypedProperties()
+      props.putAll(parameters.asJava)
+      val keyGen = constructor.newInstance(props)

Review comment:
       Reuse the KeyGenerator except the bootstrap method.




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


Reply via email to