grundprinzip commented on code in PR #38803:
URL: https://github.com/apache/spark/pull/38803#discussion_r1033007803


##########
python/pyspark/sql/connect/plan.py:
##########
@@ -177,6 +178,37 @@ def _repr_html_(self) -> str:
         """
 
 
+class LocalRelation(LogicalPlan):
+    """Creates a LocalRelation plan object based on a Pandas DataFrame."""
+
+    def __init__(self, pdf: "pandas.DataFrame") -> None:
+        super().__init__(None)
+        self._pdf = pdf
+
+    def plan(self, session: "SparkConnectClient") -> proto.Relation:
+        assert self._pdf is not None

Review Comment:
   I think you're right. It makes sense to move the assertion into the session. 
   
   As an FYI, all of the mypy checks are really just for the code that we 
write. During runtime, the user can pass whatever they want and we should make 
sure that we have proper checks for it. But since plan is internal API it makes 
a lot of sense to have the checking on the public API instead.



-- 
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]

Reply via email to