hussein-awala commented on code in PR #9444:
URL: https://github.com/apache/hudi/pull/9444#discussion_r1294078912


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieWriterUtils.scala:
##########
@@ -179,9 +179,11 @@ object HoodieWriterUtils {
       if (null != tableConfig) {
         val datasourceRecordKey = params.getOrElse(RECORDKEY_FIELD.key(), null)
         val tableConfigRecordKey = 
tableConfig.getString(HoodieTableConfig.RECORDKEY_FIELDS)
-        if ((null != datasourceRecordKey && null != tableConfigRecordKey
-          && datasourceRecordKey != tableConfigRecordKey) || (null != 
datasourceRecordKey && datasourceRecordKey.nonEmpty
-          && tableConfigRecordKey == null)) {
+        val dsnull = datasourceRecordKey == null
+        val tcnull = tableConfigRecordKey == null
+        if ((!dsnull && !tcnull && datasourceRecordKey != tableConfigRecordKey)
+          || (!dsnull && datasourceRecordKey.nonEmpty
+          && tcnull) || ((dsnull || datasourceRecordKey.isEmpty) && !tcnull)) {

Review Comment:
   I'm not sure, but I wonder if tableConfigRecordKey could be empty string
   ```suggestion
             && tcnull) || ((dsnull || datasourceRecordKey.isEmpty) && !tcnull 
&& tableConfigRecordKey.nonEmpty)) {
   ```



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to