zero323 commented on a change in pull request #35252:
URL: https://github.com/apache/spark/pull/35252#discussion_r790270197
##########
File path: python/pyspark/rdd.py
##########
@@ -2923,11 +3297,38 @@ def getResourceProfile(self):
else:
return None
+ @overload
+ def toDF(
+ self: "RDD[RowLike]",
+ schema: Optional[Union[List[str], Tuple[str, ...]]] = None,
+ sampleRatio: Optional[float] = None,
+ ) -> "DataFrame":
+ ...
+
+ @overload
+ def toDF(
+ self: "RDD[RowLike]", schema: Optional[Union["StructType", str]] = None
+ ) -> "DataFrame":
+ ...
+
+ @overload
+ def toDF(
+ self: "RDD[AtomicValue]",
+ schema: Union["AtomicType", str],
+ ) -> "DataFrame":
+ ...
+
+ def toDF(
+ self: "RDD[Any]", schema: Optional[Any] = None, sampleRatio:
Optional[float] = None
+ ) -> "DataFrame":
+ raise RuntimeError("""RDD.toDF was called before SparkSession was
initialized.""")
Review comment:
Just noticed that [this](https://github.com/python/mypy/pull/11944) was
merged. So I guess we can wait for upgrade to mypy to dev and drop the
implementation.
--
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]