spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Dimiduk (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-19615) Provide Dataset union convenience for divergent schema
Date Thu, 16 Feb 2017 18:58:41 GMT

    [ https://issues.apache.org/jira/browse/SPARK-19615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15870513#comment-15870513
] 

Nick Dimiduk commented on SPARK-19615:
--------------------------------------

IMHO, a union operation should be as generous as possible. This facilitates common ETL and
data cleansing operations where the sources are sparse-schema structures (JSON, HBase, Elastic
Search, &c). A couple examples of what I mean.

Given dataframes of type
{noformat}
root
 |-- a: string (nullable = false)
 |-- b: string (nullable = true)
{noformat}
and
{noformat}
root
 |-- a: string (nullable = false)
 |-- c: string (nullable = true)
{noformat}
I would expect the union operation to infer the nullable columns from both sides to produce
a dataframe of type
{noformat}
root
 |-- a: string (nullable = false)
 |-- b: string (nullable = true)
 |-- c: string (nullable = true)
{noformat}

This should work on an arbitrarily deep nesting of structs, so

{noformat}
root
 |-- a: string (nullable = false)
 |-- b: struct (nullable = false)
 |    |-- b1: string (nullable = true)
 |    |-- b2: string (nullable = true)
{noformat}
unioned with
{noformat}
root
 |-- a: string (nullable = false)
 |-- b: struct (nullable = false)
 |    |-- b3: string (nullable = true)
 |    |-- b4: string (nullable = true)
{noformat}
would result in
{noformat}
root
 |-- a: string (nullable = false)
 |-- b: struct (nullable = false)
 |    |-- b1: string (nullable = true)
 |    |-- b2: string (nullable = true)
 |    |-- b3: string (nullable = true)
 |    |-- b4: string (nullable = true)
{noformat}

> Provide Dataset union convenience for divergent schema
> ------------------------------------------------------
>
>                 Key: SPARK-19615
>                 URL: https://issues.apache.org/jira/browse/SPARK-19615
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.1.0
>            Reporter: Nick Dimiduk
>            Priority: Minor
>
> Creating a union DataFrame over two sources that have different schema definitions is
surprisingly complex. Provide a version of the union method that will create a infer a target
schema as the result of merging the sources. Automatically add extend either side with {{null}}
columns for any missing columns that are nullable.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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


Mime
View raw message