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


##########
hudi-spark-datasource/hudi-spark3-common/src/main/scala/org/apache/spark/sql/hudi/command/MergeIntoHoodieTableCommand.scala:
##########
@@ -600,8 +603,14 @@ case class MergeIntoHoodieTableCommand(mergeInto: 
MergeIntoTable) extends Hoodie
       && getPartialUpdateMode(parameters).isEmpty)
   }
 
+  /**
+   * A table with record key(s) is upserted when the statement has a matched 
clause, since only the index
+   * lookup finds the target record the clause applies to.
+   */
   private def getOperationType(parameters: Map[String, String]) = {
-    if 
(StringUtils.isNullOrEmpty(ConfigUtils.getOrderingFieldsStrDuringWrite(parameters.asJava))
 && updatingActions.isEmpty) {
+    val hasMatchedClauseToApply = if (hasPrimaryKey()) 
mergeInto.matchedActions.nonEmpty else updatingActions.nonEmpty

Review Comment:
   Follow-up: a key deleted again after a re-insert has deleted copies in two 
file groups and no live one, and the target read now inserts it once rather 
than once per file group (the deleted-key test covers it). The delete plus 
insert target read now applies only to tables without an ordering field, so an 
event-time table keeps the write of #20857.



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