zhengruifeng commented on code in PR #38734: URL: https://github.com/apache/spark/pull/38734#discussion_r1028789393
########## python/pyspark/sql/connect/dataframe.py: ########## @@ -122,6 +122,20 @@ def withPlan(cls, plan: plan.LogicalPlan, session: "RemoteSparkSession") -> "Dat new_frame._plan = plan return new_frame + def isEmpty(self) -> bool: + """Returns ``True`` if this :class:`DataFrame` is empty. + + .. versionadded:: 3.4.0 + + Returns + ------- + bool + Whether it's empty DataFrame or not. + """ + if "is_empty" not in self._cache: + self._cache["is_empty"] = len(self.take(1)) == 0 + return bool(self._cache["is_empty"]) Review Comment: oh, let me update it. Maybe it is time to design how to do the caching, I will work on it. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org