beliefer commented on code in PR #39262:
URL: https://github.com/apache/spark/pull/39262#discussion_r1058893340
##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -1013,6 +1013,42 @@ def test_stat_cov(self):
self.spark.read.table(self.tbl_name2).stat.cov("col1", "col3"),
)
+ def test_stat_approx_quantile(self):
+ # SPARK-41069: Test the stat.approxQuantile method
+ result = self.connect.read.table(self.tbl_name2).stat.approxQuantile(
+ ["col1", "col3"], [0.1, 0.5, 0.9], 0.1
+ )
+ self.assertEqual(len(result), 2)
+ self.assertEqual(len(result[0]), 3)
+ self.assertEqual(len(result[1]), 3)
+
+ with self.assertRaisesRegex(
+ TypeError, "col should be a string, list or tuple, but got <class
'int'>"
+ ):
+ self.connect.read.table(self.tbl_name2).stat.approxQuantile(1,
[0.1, 0.5, 0.9], 0.1)
+ with self.assertRaisesRegex(TypeError, "columns should be strings, but
got <class 'int'>"):
+ self.connect.read.table(self.tbl_name2).stat.approxQuantile([1],
[0.1, 0.5, 0.9], 0.1)
+ with self.assertRaisesRegex(TypeError, "probabilities should be a list
or tuple"):
+
self.connect.read.table(self.tbl_name2).stat.approxQuantile(["col1", "col3"],
0.1, 0.1)
+ with self.assertRaises(ValueError) as context:
Review Comment:
It works worse.
--
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]