yihua commented on code in PR #20888:
URL: https://github.com/apache/hudi/pull/20888#discussion_r4703618510


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieCreateRecordUtils.scala:
##########
@@ -156,8 +157,11 @@ object HoodieCreateRecordUtils {
             val hoodieRecord = if (shouldCombine && !orderingFields.isEmpty) {
               val orderingVal = getOrderingValue(orderingFields, avroRec, 
hoodieKey.getRecordKey,
                 consistentLogicalTimestampEnabled, requiresOrderingValue)
+              // The clauses of a Spark SQL MERGE INTO decide on write whether 
a record that is not flagged as a
+              // delete deletes the record it matches
+              val knownDelete: java.lang.Boolean = if (isDelete || 
!sqlMergeIntoWrites) isDelete else null

Review Comment:
   Confirmed, and it fails without an ordering field too. The fix moved to 
`HoodieAvroRecord#isDelete`, only for payloads that decide the delete on write 
(`DefaultHoodieRecordPayload` can produce a sentinel too, so not every such 
payload), with keyed tests for the global and record level indexes. Under event 
time ordering a delete that loses to its row would still remove the key from 
the record level index (#20942), so such a statement on a merge-on-read table 
that uses or maintains a record level index is now refused; commit time 
ordering applies it with every index.



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