[
https://issues.apache.org/jira/browse/SPARK-61888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Tenedorio resolved SPARK-61888.
--------------------------------------
Fix Version/s: 4.5.0
Resolution: Fixed
Issue resolved by pull request 60629
[https://github.com/apache/spark/pull/60629]
> Add pipe |> EVAL to replace or append columns
> ---------------------------------------------
>
> Key: SPARK-61888
> URL: https://issues.apache.org/jira/browse/SPARK-61888
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 5.0.0, 4.5.0
> Reporter: Steve Zhang
> Assignee: Steve Zhang
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.5.0
>
>
> This tracks adding the SQL pipe operator {{|> EVAL}}, which replaces or
> appends columns.
> Today, a {{|> SET}} assignment to a column that does not exist in the input
> table fails with {{UNRESOLVED_COLUMN}}, while {{|> EXTEND}} adds a second
> column when one with that name already exists. A query that sets the same
> column on inputs with different schemas, such as when normalizing data from
> several sources, therefore has to know each input's schema. {{|> EVAL}} takes
> the same assignments as {{|> SET}}. An assignment to a column that exists
> replaces it in place, as {{SET}} does, and an assignment to a column that
> does not exist appends it after the existing columns, as {{EXTEND}} does.
> {code:sql}
> -- t has the columns x INT and y STRING.
> TABLE t
> |> EVAL z = x + length(y), x = x * 10, zz = z + x;
> -- Output columns: x, y, z, zz. x is replaced in place; z and zz are appended.
> {code}
> {{EVAL}} is a new non-reserved keyword. Existing operators, including
> {{SET}}, don't change.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]