This is an automated email from the ASF dual-hosted git repository. ruifengz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new 5d2d9155d24 [SPARK-45121][CONNECT][PS] Support `Series.empty` for Spark Connect 5d2d9155d24 is described below commit 5d2d9155d24ea9a466e1868969dccd4ae1ac7278 Author: Haejoon Lee <haejoon....@databricks.com> AuthorDate: Tue Sep 12 14:37:52 2023 +0800 [SPARK-45121][CONNECT][PS] Support `Series.empty` for Spark Connect ### What changes were proposed in this pull request? This PR proposes to support Series.empty for Spark Connect by removing JVM dependency. ### Why are the changes needed? Increase API coverage for Spark Connect. ### Does this PR introduce _any_ user-facing change? `Series.empty` is available on Spark Connect. ### How was this patch tested? Added UT. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #42877 from itholic/SPARK-45121. Authored-by: Haejoon Lee <haejoon....@databricks.com> Signed-off-by: Ruifeng Zheng <ruife...@apache.org> --- python/pyspark/pandas/base.py | 2 +- python/pyspark/pandas/tests/series/test_series.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/pyspark/pandas/base.py b/python/pyspark/pandas/base.py index 1cb17de89e8..ef0b51f757d 100644 --- a/python/pyspark/pandas/base.py +++ b/python/pyspark/pandas/base.py @@ -505,7 +505,7 @@ class IndexOpsMixin(object, metaclass=ABCMeta): >>> ps.DataFrame({}, index=list('abc')).index.empty False """ - return self._internal.resolved_copy.spark_frame.rdd.isEmpty() + return self._internal.resolved_copy.spark_frame.isEmpty() @property def hasnans(self) -> bool: diff --git a/python/pyspark/pandas/tests/series/test_series.py b/python/pyspark/pandas/tests/series/test_series.py index 136d905eb49..aa147aa75cf 100644 --- a/python/pyspark/pandas/tests/series/test_series.py +++ b/python/pyspark/pandas/tests/series/test_series.py @@ -113,6 +113,8 @@ class SeriesTestsMixin: self.assert_eq(ps.from_pandas(pser_a), pser_a) self.assert_eq(ps.from_pandas(pser_b), pser_b) + self.assertTrue(pser_a.empty) + def test_all_null_series(self): pser_a = pd.Series([None, None, None], dtype="float64") pser_b = pd.Series([None, None, None], dtype="str") --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org