[
https://issues.apache.org/jira/browse/SPARK-55356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan reassigned SPARK-55356:
-----------------------------------
Assignee: Filip Davidovic
> Support alias in Spark SQL PIVOT
> --------------------------------
>
> Key: SPARK-55356
> URL: https://issues.apache.org/jira/browse/SPARK-55356
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 4.1.1
> Reporter: Filip Davidovic
> Assignee: Filip Davidovic
> Priority: Major
> Labels: pull-request-available
>
> As title suggests, add support for alias on the PIVOT clause.
> {quote}Extend the {{PIVOT}} clause to accept an optional alias ({{{}PIVOT
> (...) AS alias{}}}), allowing the pivoted result set to be referenced by name
> in the surrounding query context. The alias qualifies all columns produced by
> the pivot operation, including both the grouping columns and the dynamically
> generated value columns. When an alias is provided, columns may be referenced
> as {{{}alias.column_name{}}}. When omitted, current unqualified resolution
> behaviour is preserved. In queries with multiple pivots or joins, the alias
> disambiguates column references. The alias scope is limited to the query
> block in which the pivot appears.
> {quote}
> Main reason for the improvement is parity with platforms like SQL Server and
> Snowflake. When customers want to migrate, their queries using PIVOT alias
> can't be automatically transpiled, requiring a human in the loop.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]