You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/05/27 01:21:34 UTC

[GitHub] [spark] itholic commented on pull request #36640: [SPARK-39262][PYTHON] Correct the behavior of creating DataFrame from an RDD

itholic commented on PR #36640:
URL: https://github.com/apache/spark/pull/36640#issuecomment-1139193145

   > After further consideration, the behaviors below are expected:
   > 
   > ```python
   > >>> spark.createDataFrame(spark._sc.parallelize([[1], [2]])).show()
   > +---+
   > | _1|
   > +---+
   > |  1|
   > |  2|
   > +---+
   > 
   > >>> spark.createDataFrame(spark._sc.parallelize([[],[]])).show()
   > ++
   > ||
   > ++
   > ||
   > ||
   > ++
   > ```
   > 
   > that's because bolded **[]** in [**[]**,..] marks a row in PySpark.
   > 
   > So the PR is adjusted to enable `[[],[]]` input, by simply bypassing the check `if not first:`.
   > 
   > The input as `[None, None]` will raise the `ValueError` as before.
   > 
   > ```python
   > >>> spark.createDataFrame(spark._sc.parallelize([None, None])).show()
   > Traceback (most recent call last):
   > ...
   > ValueError: The first row in RDD is empty, can not infer schema
   > ```
   > 
   > CC @ueshin @HyukjinKwon @itholic
   
   Sounds good to me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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