You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2023/01/29 00:51:55 UTC

[spark] branch master updated: [SPARK-41830][CONNECT][PYTHON][TESTS][FOLLOWUP] Enable parity test `test_sample`

This is an automated email from the ASF dual-hosted git repository.

dongjoon 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 2fa1d6be8f6 [SPARK-41830][CONNECT][PYTHON][TESTS][FOLLOWUP] Enable parity test `test_sample`
2fa1d6be8f6 is described below

commit 2fa1d6be8f6fe9e71f2def743484940b8c4b6dbf
Author: Ruifeng Zheng <ru...@apache.org>
AuthorDate: Sat Jan 28 16:51:40 2023 -0800

    [SPARK-41830][CONNECT][PYTHON][TESTS][FOLLOWUP] Enable parity test `test_sample`
    
    ### What changes were proposed in this pull request?
    Enable parity test `test_sample`
    
    ### Why are the changes needed?
    For test coverage
    
    ### Does this PR introduce _any_ user-facing change?
    no, test-only
    
    ### How was this patch tested?
    enabled test
    
    Closes #39765 from zhengruifeng/connect_enable_41830.
    
    Authored-by: Ruifeng Zheng <ru...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 python/pyspark/sql/tests/connect/test_parity_dataframe.py | 5 -----
 python/pyspark/sql/tests/test_dataframe.py                | 6 +++++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/python/pyspark/sql/tests/connect/test_parity_dataframe.py b/python/pyspark/sql/tests/connect/test_parity_dataframe.py
index db0d727d330..e04119bea9f 100644
--- a/python/pyspark/sql/tests/connect/test_parity_dataframe.py
+++ b/python/pyspark/sql/tests/connect/test_parity_dataframe.py
@@ -95,11 +95,6 @@ class DataFrameParityTests(DataFrameTestsMixin, ReusedConnectTestCase):
     def test_same_semantics_error(self):
         super().test_same_semantics_error()
 
-    # TODO(SPARK-41830): Fix DataFrame.sample parameters
-    @unittest.skip("Fails in Spark Connect, should enable.")
-    def test_sample(self):
-        super().test_sample()
-
     @unittest.skip("Spark Connect does not support RDD but the tests depend on them.")
     def test_toDF_with_schema_string(self):
         super().test_toDF_with_schema_string()
diff --git a/python/pyspark/sql/tests/test_dataframe.py b/python/pyspark/sql/tests/test_dataframe.py
index 845cf0f1fbe..0ba0649245c 100644
--- a/python/pyspark/sql/tests/test_dataframe.py
+++ b/python/pyspark/sql/tests/test_dataframe.py
@@ -46,6 +46,7 @@ from pyspark.sql.types import (
 from pyspark.errors import (
     AnalysisException,
     IllegalArgumentException,
+    SparkConnectException,
     SparkConnectAnalysisException,
 )
 from pyspark.testing.sqlutils import (
@@ -888,7 +889,10 @@ class DataFrameTestsMixin:
 
         self.assertRaises(TypeError, lambda: self.spark.range(1).sample(seed="abc"))
 
-        self.assertRaises(IllegalArgumentException, lambda: self.spark.range(1).sample(-1.0))
+        self.assertRaises(
+            (IllegalArgumentException, SparkConnectException),
+            lambda: self.spark.range(1).sample(-1.0).count(),
+        )
 
     def test_toDF_with_schema_string(self):
         data = [Row(key=i, value=str(i)) for i in range(100)]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org