HyukjinKwon commented on code in PR #36893: URL: https://github.com/apache/spark/pull/36893#discussion_r919529370
########## python/pyspark/sql/session.py: ########## @@ -1023,6 +1023,20 @@ def prepare(obj: Any) -> Any: if isinstance(data, RDD): rdd, struct = self._createFromRDD(data.map(prepare), schema, samplingRatio) + elif isinstance(data, list) and schema is None: + # Wrap each element with a tuple if there is any scalar in the list + + has_scalar = any( + isinstance(x, str) + or ( + not isinstance(x, Sized) Review Comment: How does this work in case of nested types? e.g., `spark.createDataFrame([(1,), (2,)], schema='struct<a: int>')`. We should probably check how the Scala side works, and match the behaviour. -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org