You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/25 22:35:44 UTC

[GitHub] [spark] ueshin opened a new pull request, #36674: [SPARK-39293][SQL] Fix the accumulator of ArrayAggregate to handle complex types properly

ueshin opened a new pull request, #36674:
URL: https://github.com/apache/spark/pull/36674

   ### What changes were proposed in this pull request?
   
   Fix the accumulator of `ArrayAggregate` to handle complex types properly.
   
   The accumulator of `ArrayAggregate` should copy the intermediate result if string, struct, array, or map.
   
   ### Why are the changes needed?
   
   If the intermediate data of `ArrayAggregate` holds reusable data, the result will be duplicated.
   
   ```scala
   import org.apache.spark.sql.functions._
   
   val reverse = udf((s: String) => s.reverse)
   
   val df = Seq(Array("abc", "def")).toDF("array")
   val testArray = df.withColumn(
     "agg",
     aggregate(
       col("array"),
       array().cast("array<string>"),
       (acc, s) => concat(acc, array(reverse(s)))))
   
   aggArray.show(truncate=false)
   ```
   
   should be:
   
   ```
   +----------+----------+
   |array     |agg       |
   +----------+----------+
   |[abc, def]|[cba, fed]|
   +----------+----------+
   ```
   
   but:
   
   ```
   +----------+----------+
   |array     |agg       |
   +----------+----------+
   |[abc, def]|[fed, fed]|
   +----------+----------+
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this fixes the correctness issue.
   
   ### How was this patch tested?
   
   Added a test.
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon closed pull request #36674: [SPARK-39293][SQL] Fix the accumulator of ArrayAggregate to handle complex types properly

Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #36674: [SPARK-39293][SQL] Fix the accumulator of ArrayAggregate to handle complex types properly
URL: https://github.com/apache/spark/pull/36674


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #36674: [SPARK-39293][SQL] Fix the accumulator of ArrayAggregate to handle complex types properly

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on PR #36674:
URL: https://github.com/apache/spark/pull/36674#issuecomment-1138051592

   Merged to master, branch-3.3, branch-3.2, branch-3.1 and branch-3.0.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org