You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2020/03/16 22:54:10 UTC

[jira] [Updated] (SPARK-26879) Inconsistency in default column names for functions like inline and stack

     [ https://issues.apache.org/jira/browse/SPARK-26879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dongjoon Hyun updated SPARK-26879:
----------------------------------
    Affects Version/s:     (was: 3.0.0)
                       3.1.0

> Inconsistency in default column names for functions like inline and stack
> -------------------------------------------------------------------------
>
>                 Key: SPARK-26879
>                 URL: https://issues.apache.org/jira/browse/SPARK-26879
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.1.0
>            Reporter: Jash Gala
>            Priority: Minor
>
> In the Spark SQL functions definitions, `inline` uses col1, col2, etc. (i.e. 1-indexed columns), while `stack` uses col0, col1, col2, etc. (i.e. 0-indexed columns).
> {code:title=spark-shell|borderStyle=solid}
> scala> spark.sql("SELECT stack(2, 1, 2, 3)").show
> +----+----+
> |col0|col1|
> +----+----+
> |   1|   2|
> |   3|null|
> +----+----+
> scala>  spark.sql("SELECT inline_outer(array(struct(1, 'a'), struct(2, 'b')))").show
> +----+----+
> |col1|col2|
> +----+----+
> |   1|   a|
> |   2|   b|
> +----+----+
> {code}
> This feels like an issue with consistency. As discussed on [PR #23748|https://github.com/apache/spark/pull/23748], it might be a good idea to standardize this to something specific (like zero-based indexing) for these and other similar functions.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org