dongjoon-hyun commented on code in PR #46456:
URL: https://github.com/apache/spark/pull/46456#discussion_r1593374153


##########
python/pyspark/sql/tests/test_dataframe.py:
##########
@@ -430,6 +430,11 @@ def test_sample(self):
             IllegalArgumentException, lambda: 
self.spark.range(1).sample(-1.0).count()
         )
 
+    def test_sample_with_random_seed(self):
+        df = self.spark.range(10000).sample(0.1)
+        cnts = [df.count() for i in range(10)]
+        self.assertEqual(1, len(set(cnts)))

Review Comment:
   Oh, it seems that we have a unit test.
   
   ```
   FAIL [0.001s]: test_sample 
(pyspark.sql.tests.connect.test_connect_plan.SparkConnectPlanTests.test_sample)
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/__w/spark/spark/python/pyspark/sql/tests/connect/test_connect_plan.py", line 
446, in test_sample
       self.assertEqual(plan.root.sample.HasField("seed"), False)
   AssertionError: True != False
   ```



##########
python/pyspark/sql/tests/test_dataframe.py:
##########
@@ -430,6 +430,11 @@ def test_sample(self):
             IllegalArgumentException, lambda: 
self.spark.range(1).sample(-1.0).count()
         )
 
+    def test_sample_with_random_seed(self):
+        df = self.spark.range(10000).sample(0.1)
+        cnts = [df.count() for i in range(10)]
+        self.assertEqual(1, len(set(cnts)))

Review Comment:
   Oh, it seems that we have a unit test. Could you update it?
   
   ```
   FAIL [0.001s]: test_sample 
(pyspark.sql.tests.connect.test_connect_plan.SparkConnectPlanTests.test_sample)
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/__w/spark/spark/python/pyspark/sql/tests/connect/test_connect_plan.py", line 
446, in test_sample
       self.assertEqual(plan.root.sample.HasField("seed"), False)
   AssertionError: True != False
   ```



-- 
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

Reply via email to