You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "Zouxxyy (via GitHub)" <gi...@apache.org> on 2023/11/22 05:13:39 UTC

[PR] [spark] merge into support update nested column [incubator-paimon]

Zouxxyy opened a new pull request, #2365:
URL: https://github.com/apache/incubator-paimon/pull/2365

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #xxx
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [spark] Merge into support update nested column [incubator-paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #2365:
URL: https://github.com/apache/incubator-paimon/pull/2365


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [spark] Merge into support update nested column [incubator-paimon]

Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on PR #2365:
URL: https://github.com/apache/incubator-paimon/pull/2365#issuecomment-1822627308

   +1


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [spark] Merge into support update nested column [incubator-paimon]

Posted by "YannByron (via GitHub)" <gi...@apache.org>.
YannByron commented on code in PR #2365:
URL: https://github.com/apache/incubator-paimon/pull/2365#discussion_r1401676633


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/spark/sql/catalyst/analysis/AssignmentAlignmentHelper.scala:
##########
@@ -35,24 +36,32 @@ trait AssignmentAlignmentHelper extends SQLConfHelper {
   private case class AttrUpdate(ref: Seq[String], expr: Expression)
 
   /**
-   * Align update assignments to the given attrs, only supports PrimitiveType and StructType. For
-   * example, if attrs are [a int, b int, s struct(c1 int, c2 int)] and update assignments are [a =
-   * 1, s.c1 = 2], will return [1, b, struct(2, c2)].
+   * Generate aligned expressions, only supports PrimitiveType and StructType. For example, if attrs
+   * are [a int, b int, s struct(c1 int, c2 int)] and update assignments are [a = 1, s.c1 = 2], will
+   * return [1, b, struct(2, c2)].
    * @param attrs
    *   target attrs
    * @param assignments
    *   update assignments
    * @return
-   *   aligned update expressions
+   *   aligned expressions
    */
-  protected def alignUpdateAssignments(
+  protected def generateAlignedExpressions(
       attrs: Seq[Attribute],
       assignments: Seq[Assignment]): Seq[Expression] = {
     val attrUpdates = assignments.map(a => AttrUpdate(toRefSeq(a.key), a.value))
     recursiveAlignUpdates(attrs, attrUpdates)
   }
 
-  def toRefSeq(expr: Expression): Seq[String] = expr match {
+  protected def alignAssignments(
+      attrs: Seq[Attribute],
+      assignments: Seq[Assignment]): Seq[Assignment] = {
+    generateAlignedExpressions(attrs, assignments).zip(attrs).map {
+      case (expression, field) => Assignment(field, expression)
+    }
+  }
+
+  private def toRefSeq(expr: Expression): Seq[String] = expr match {

Review Comment:
   can we move this method to `ExpressionHelper`~



-- 
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: issues-unsubscribe@paimon.apache.org

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