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

   ### What changes were proposed in this pull request?
   
   WIP
   
   This is a branch of https://github.com/apache/spark/pull/48047 and the 
difference from that PR is the new content 
([comparison](https://github.com/apache/spark/compare/557bd0c016cda1c1992295013a7fbfbaf6f90deb..9929f63254d6d90670f96b83237759bc6ba0e062)).
   
   This PR adds SQL pipe syntax support for the PIVOT and UNPIVOT operators.
   
   For example:
   
   ```
   CREATE TEMPORARY VIEW courseSales AS SELECT * FROM VALUES
     ("dotNET", 2012, 10000),
     ("Java", 2012, 20000),
     ("dotNET", 2012, 5000),
     ("dotNET", 2013, 48000),
     ("Java", 2013, 30000)
     as courseSales(course, year, earnings);
   
   TABLE courseSales
   |> select `year`, course, earnings
   |> pivot (
        sum(earnings)
        for course in ('dotNET', 'Java')
     );
   
   2012 15000   20000
   2013 48000   30000
   ```
   
   ### Why are the changes needed?
   
   The SQL pipe operator syntax will let users compose queries in a more 
flexible fashion.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, see above.
   
   ### How was this patch tested?
   
   This PR adds a few unit test cases, but mostly relies on golden file test 
coverage. I did this to make sure the answers are correct as this feature is 
implemented and also so we can look at the analyzer output plans to ensure they 
look right as well.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to