amaliujia commented on code in PR #38742:
URL: https://github.com/apache/spark/pull/38742#discussion_r1032619631
##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -822,6 +821,83 @@ def schema(self) -> StructType:
else:
return self._schema
+ @property
+ def isLocal(self) -> bool:
+ """Returns ``True`` if the :func:`collect` and :func:`take` methods
can be run locally
+ (without any Spark executors).
+
+ .. versionadded:: 3.4.0
+
+ Returns
+ -------
+ bool
+ """
+ if self._plan is None:
+ raise Exception("Cannot analyze on empty plan.")
+ query = self._plan.to_proto(self._session)
+ return self._session._analyze(query).is_local
Review Comment:
We literally can cache everything for each DataFrame since it is immutable.
But I guess we need a design/discussion to clarify details of how.
##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -822,6 +821,83 @@ def schema(self) -> StructType:
else:
return self._schema
+ @property
+ def isLocal(self) -> bool:
+ """Returns ``True`` if the :func:`collect` and :func:`take` methods
can be run locally
+ (without any Spark executors).
+
+ .. versionadded:: 3.4.0
+
+ Returns
+ -------
+ bool
+ """
+ if self._plan is None:
+ raise Exception("Cannot analyze on empty plan.")
+ query = self._plan.to_proto(self._session)
+ return self._session._analyze(query).is_local
Review Comment:
We literally can cache everything for each DataFrame since it is immutable.
But I guess we need a design/discussion to clarify details of how and when.
--
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]