xinrong-databricks commented on code in PR #36893:
URL: https://github.com/apache/spark/pull/36893#discussion_r917160564
##########
python/pyspark/sql/session.py:
##########
@@ -1023,6 +1023,12 @@ 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:
Review Comment:
Respect the existing behavior when `schema` is given.
Specifically,
```py
>>> spark.createDataFrame([1, 2], schema='int')
DataFrame[value: int]
>>> spark.createDataFrame([(1,), (2,)], schema='int')
...
TypeError: field value: IntegerType() can not accept object (1,) in type
<class 'tuple'>
```
Adjusting the inconsistency above is out of the scope of this PR and ought
to be a follow-up.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]