danny0405 commented on code in PR #9665:
URL: https://github.com/apache/hudi/pull/9665#discussion_r1320910435


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/AutoRecordKeyGenerationUtils.scala:
##########
@@ -54,7 +51,9 @@ object AutoRecordKeyGenerationUtils {
     }
   }
 
-  def isAutoGenerateRecordKeys(parameters: Map[String, String]): Boolean = {
-    !parameters.contains(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key()) // if 
record key is not configured,
+  def shouldAutoGenerateRecordKeys(parameters: Map[String, String]): Boolean = 
{
+    val recordKeyFromTableConfig = 
parameters.getOrElse(HoodieTableConfig.RECORDKEY_FIELDS.key(), "")
+    val recordKeyFromWriterConfig = 
parameters.getOrElse(KeyGeneratorOptions.RECORDKEY_FIELD_NAME.key(), "")
+    recordKeyFromTableConfig.isEmpty && recordKeyFromWriterConfig.isEmpty

Review Comment:
   There is no need to check two times, the `parameters` is inferred and merged 
from hoodie table config already.



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

Reply via email to