HyukjinKwon opened a new pull request #32517:
URL: https://github.com/apache/spark/pull/32517


   ### What changes were proposed in this pull request?
   
   This PR fixes the same issue as https://github.com/apache/spark/pull/32424
   
   ```r
   df <- sql("SELECT array(1, 2, 3) as numbers, array('a', 'b', 'c') as 
letters")
   collect(select(
     df,
     array_transform("numbers", function(number) {
       array_transform("letters", function(latter) {
         struct(alias(number, "n"), alias(latter, "l"))
       })
     })
   ))
   ```
   
   **Before:**
   
   ```
     transform(numbers, lambdafunction(transform(letters, 
lambdafunction(struct(namedlambdavariable() AS n, namedlambdavariable() AS l), 
namedlambdavariable())), namedlambdavariable()))
   1                                                                            
                                                     a, a, b, b, c, c, a, a, b, 
b, c, c, a, a, b, b, c, c
   ```
   
   **After:**
   
   ```
     transform(numbers, lambdafunction(transform(letters, 
lambdafunction(struct(namedlambdavariable() AS n, namedlambdavariable() AS l), 
namedlambdavariable())), namedlambdavariable()))
   1                                                                            
                                                     1, a, 1, b, 1, c, 2, a, 2, 
b, 2, c, 3, a, 3, b, 3, c
   ```
   
   ### Why are the changes needed?
   
   To produce the correct results.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, it fixes the results to be correct as mentioned above.
   
   ### How was this patch tested?
   
   Manually tested as above, and unit test was added.


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

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



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

Reply via email to