lokeshj1703 commented on code in PR #7668:
URL: https://github.com/apache/hudi/pull/7668#discussion_r1083431651


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala:
##########
@@ -203,6 +207,34 @@ object HoodieWriterUtils {
       diffConfigs.insert(0, "\nConfig conflict(key\tcurrent value\texisting 
value):\n")
       throw new HoodieException(diffConfigs.toString.trim)
     }
+
+    if 
(hoodieConfig.getBoolean(KeyGeneratorOptions.AUTO_GENERATE_RECORD_KEYS)) {
+      val autoGenerateRecordKey = 
KeyGeneratorOptions.AUTO_GENERATE_RECORD_KEYS.key()
+      if (hoodieConfig.getBoolean(HoodieWriteConfig.COMBINE_BEFORE_INSERT)) {
+        throw new HoodieKeyGeneratorException(s"Config $autoGenerateRecordKey 
can not be used when " +
+          s"${HoodieWriteConfig.COMBINE_BEFORE_INSERT.key()} is enabled")
+      }
+      if 
(!hoodieConfig.getBoolean(HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE))
 {
+        throw new HoodieKeyGeneratorException(s"Config 
${HoodieWriteConfig.MERGE_ALLOW_DUPLICATE_ON_INSERTS_ENABLE.key()} " +
+          s"should be enabled when $autoGenerateRecordKey is used")
+      }
+      if (hoodieConfig.getString(DataSourceWriteOptions.TABLE_TYPE) == 
MOR_TABLE_TYPE_OPT_VAL) {
+        throw new HoodieKeyGeneratorException(s"Config 
${DataSourceWriteOptions.TABLE_TYPE.key()} should be set to " +
+          s"COW_TABLE_TYPE_OPT_VAL when $autoGenerateRecordKey is used")
+      }
+      if (hoodieConfig.getString(OPERATION) == UPSERT_OPERATION_OPT_VAL) {

Review Comment:
   Should we change condition to succeed only if insert and bulk insert is 
enabled? Is it possible for some other operation to execute in this function 
apart from {insert,upsert and bulk insert}



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