You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/06/22 11:20:35 UTC

[GitHub] [hudi] shenjiayu17 commented on a diff in pull request #5828: [HUDI-4219] Merge Into when update expression "col=s.col+2" on precombine cause exception

shenjiayu17 commented on code in PR #5828:
URL: https://github.com/apache/hudi/pull/5828#discussion_r903613467


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/MergeIntoHoodieTableCommand.scala:
##########
@@ -213,6 +221,29 @@ case class MergeIntoHoodieTableCommand(mergeInto: MergeIntoTable) extends Hoodie
     }
   }
 
+  /**
+   * Check whether expression of preCombine field have the same column name with target column.
+   *
+   * Merge expression cases that return true:
+   * 1) merge into .. on .. update set ts = s0.ts
+   * 2) merge into .. on .. update set ts = cast(s0.ts as int)
+   * 3) merge into .. on .. update set ts = s0.ts+1 (expressions like this whose sub node has the same column name with target)
+   * "ts" is preCombine field of h0.
+   */
+  private def isEqualToTargetPreCombineField(targetColumnName: String, sourceExpression: Expression): Boolean = {
+    val sourceColumnName = sourceDFOutput.map(_.name)
+    val resolver = sparkSession.sessionState.conf.resolver
+
+    var sourceColumnNameIsEqulaToTarget = false
+    // sub node of the expression may have same column name with target column name
+    sourceExpression.foreach {

Review Comment:
   Done



-- 
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-unsubscribe@hudi.apache.org

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