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

Apache Spark reassigned SPARK-13748:
------------------------------------

    Assignee:     (was: Apache Spark)

> createDataFrame and rows with omitted fields
> --------------------------------------------
>
>                 Key: SPARK-13748
>                 URL: https://issues.apache.org/jira/browse/SPARK-13748
>             Project: Spark
>          Issue Type: Improvement
>          Components: Documentation, PySpark, SQL
>    Affects Versions: 1.6.0
>            Reporter: Ethan Aubin
>            Priority: Minor
>
> I found it confusing that a Row with an omitted field is different from a row 
> with field present but value missing. This was originally problematic for 
> json files will varying fields, but it's comes down to something like:
> def test(rows):
>     ds = sc.parallelize(rows)
>     df = sqlContext.createDataFrame(ds,None,1)
>     print df[['y']].collect()
> test([Row(x=1,y=None),Row(x=2, y='asdf')])   # Works
> test([Row(x=1),Row(x=2, y='asdf')])  # Fails with an 
> ArrayIndexOutOfBoundsException.
> maybe more could be said in the documentation for createDataFrame or Row 
> about what's expected. Validation or correction would be helpful, as would a 
> function creating a well formed row from a structtype and dictionary.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to