News for hackers. Stuff that matters.
Re:SQL Pivot: Converting Rows to Columns by nevi-me on Thursday November 01, 2018 @12:46PM (#18355866)
I had a quick look at some online material on implementations of pivot, as well as what I consider my go-to reference [0] for Apache projects' SQL support (Apache Calcite).

Looks like each DB has a proprietary way of pivoting, and I couldn't find anything on pivot in Calcite. Does anyone know if the SQL impl of pivot was created specifically for Spark, or whether it'd be upstreamed to Calcite? The benefit would be that other projects that rely on Calcite for SQL support would also have pivot capabilities. I'm thinking of Apache Beam.

- [0] https://calcite.apache.org/docs/reference.html

Re:SQL Pivot: Converting Rows to Columns by reilly3000 on Thursday November 01, 2018 @12:56PM (#18355984)
This article enlightened me on the underlying logic, as well as some different implementations. https://modern-sql.com/use-case/pivot
Re:SQL Pivot: Converting Rows to Columns by nevi-me on Thursday November 01, 2018 @01:11PM (#18356154)
I was lazy to add its link, that's where I learnt about the proprietary implementations of various databases.

I wonder if we'll ever get an ANSI-2019 SQL version that tries to merge what various DB vendors have branched off and done. Maybe it already exists? https://www.whoishostingthis.com/resources/ansi-sql-standard...

Re:SQL Pivot: Converting Rows to Columns by rxin on Thursday November 01, 2018 @01:17PM (#18356201)
Apache Spark doesn't use Calcite.