xinrong-meng commented on code in PR #40684:
URL: https://github.com/apache/spark/pull/40684#discussion_r1183889165
##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -249,14 +254,18 @@ def crossJoin(self, other: "DataFrame") -> "DataFrame":
raise Exception("Cannot cartesian join when self._plan is empty.")
if other._plan is None:
raise Exception("Cannot cartesian join when other._plan is empty.")
-
+ self.checkSameSparkSession(other)
return DataFrame.withPlan(
plan.Join(left=self._plan, right=other._plan, on=None,
how="cross"),
session=self._session,
)
crossJoin.__doc__ = PySparkDataFrame.crossJoin.__doc__
+ def checkSameSparkSession(self, other: "DataFrame") -> None:
+ if self._session.session_id != other._session.session_id:
+ raise PySparkException("Both Datasets must belong to the same
SparkSession")
Review Comment:
Thanks! It's better to define an error class in
[python/pyspark/errors/error_classes.py](python/pyspark/errors/error_classes.py)
with a template error message. Again, that doesn't block merging the PR.
--
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]