YannByron commented on code in PR #7097:
URL: https://github.com/apache/paimon/pull/7097#discussion_r2759403061


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/catalyst/analysis/PaimonUpdateTable.scala:
##########
@@ -45,21 +45,31 @@ object PaimonUpdateTable
             val alignedExpressions =
               generateAlignedExpressions(relation.output, 
assignments).zip(relation.output)
 
-            val primaryKeys = paimonTable.primaryKeys().asScala.toSeq
-            if (!validUpdateAssignment(u.table.outputSet, primaryKeys, 
assignments)) {
-              throw new RuntimeException("Can't update the primary key 
column.")
+            val alignedAssignments = alignedExpressions.map {
+              case (expression, field) => Assignment(field, expression)
             }
 
-            if (paimonTable.coreOptions().dataEvolutionEnabled()) {
-              throw new RuntimeException(
-                "Update operation is not supported when data evolution is 
enabled yet.")
-            }
+            val alignedUpdateTable = u.copy(assignments = alignedAssignments)
+
+            if (!shouldFallbackToV1Update(table, alignedUpdateTable)) {
+              alignedUpdateTable
+            } else {
+              val primaryKeys = paimonTable.primaryKeys().asScala.toSeq

Review Comment:
   I think `update pk columns` and `update table that enable data evolution`, 
in either dsv1 or dsv2 mode, are not supported, so move these two check before 
this line:
   ```if (!shouldFallbackToV1Update(table, alignedUpdateTable)) {```



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