You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (Jira)" <ji...@apache.org> on 2022/05/31 01:26:00 UTC

[jira] [Resolved] (SPARK-39262) Correct the behavior of creating DataFrame from an RDD

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

Hyukjin Kwon resolved SPARK-39262.
----------------------------------
    Fix Version/s: 3.4.0
       Resolution: Fixed

Issue resolved by pull request 36640
[https://github.com/apache/spark/pull/36640]

> Correct the behavior of creating DataFrame from an RDD
> ------------------------------------------------------
>
>                 Key: SPARK-39262
>                 URL: https://issues.apache.org/jira/browse/SPARK-39262
>             Project: Spark
>          Issue Type: Improvement
>          Components: PySpark
>    Affects Versions: 3.4.0
>            Reporter: Xinrong Meng
>            Assignee: Xinrong Meng
>            Priority: Major
>             Fix For: 3.4.0
>
>
> Correct the behavior of creating DataFrame from an RDD **with `0` or an empty list as the first element**.
>  
> Before:
> ```py
> >>> spark.createDataFrame(spark._sc.parallelize([0, 1]))
> Traceback (most recent call last):
> ...
> ValueError: The first row in RDD is empty, can not infer schema
> >>> spark.createDataFrame(spark._sc.parallelize([[], []]))
> Traceback (most recent call last):
> ...
> ValueError: The first row in RDD is empty, can not infer schema
> ```
> After:
> ```py
> >>> spark.createDataFrame(spark._sc.parallelize([0, 1]))
> Traceback (most recent call last):                                              
> ...
> TypeError: Can not infer schema for type: <class 'int'>
> >>> spark.createDataFrame(spark._sc.parallelize([[], []]))
> DataFrame[]                                                                     
> >>> spark.createDataFrame(spark._sc.parallelize([[], []])).show()
> ++
> ||
> ++
> ||
> ||
> ++
> ```



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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