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



##########
File path: 
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala
##########
@@ -81,4 +81,33 @@ object HoodieWriterUtils {
     params.foreach(kv => props.setProperty(kv._1, kv._2))
     props
   }
+
+  /**
+   * Get the partition columns to stored to hoodie.properties.
+   * Return the partitionColumns only if it is the key generator class is the 
build-ins.
+   * For other custom key generator class, we cannot know whether or not it 
has relation
+   * with the partition columns.
+   * @param parameters
+   * @return
+   */
+  def getPartitionColumns(parameters: Map[String, String]): Option[String] = {
+    val  keyGenClass = parameters.getOrElse(KEYGENERATOR_CLASS_OPT_KEY,
+      DEFAULT_KEYGENERATOR_CLASS_OPT_VAL)
+    val partitionColumns = parameters.get(PARTITIONPATH_FIELD_OPT_KEY)
+    if (keyGenClass == classOf[SimpleKeyGenerator].getName ||
+        keyGenClass == classOf[ComplexKeyGenerator].getName ||
+        keyGenClass == classOf[TimestampBasedKeyGenerator].getName) {

Review comment:
       Good suggestion!




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