New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-41830][CONNECT][PYTHON][TESTS][FOLLOWUP] Enable parity test test_sample
#39765
Conversation
@@ -884,7 +888,10 @@ def test_sample(self): | |||
|
|||
self.assertRaises(TypeError, lambda: self.spark.range(1).sample(seed="abc")) | |||
|
|||
self.assertRaises(IllegalArgumentException, lambda: self.spark.range(1).sample(-1.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itholic should we and a new subclass for IllegalArgumentException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gentle ping, @itholic .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhengruifeng Maybe are you asking if we want to add a new subclass for IllegalArgumentException
such as PySparkIllegalArgumentException
?
If so, I don't think so because the IllegalArgumentException
already has its own proper error class and handled in JVM side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I got it. We should catch IllegalArgumentException
properly before SparkConnectException
occurred in Spark Connect as mentioned in https://github.com/apache/spark/pull/39765/files#r1089673621.
Let me handle this in a separate ticket.
Could you rebase this PR, @zhengruifeng ? There is a conflict after merging your another PR in this area. |
@dongjoon-hyun Sure, thanks for the reviews of these test PRs! |
21966b8
to
c2500c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good.
@@ -888,7 +889,10 @@ def test_sample(self): | |||
|
|||
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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No a big deal, I think maybe we can catch SparkConnectGrpcException
for more precious exception testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refine Spark Connect error to throw IllegalArgumentException
similarly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refine Spark Connect error to throw
IllegalArgumentException
similarly?
Ah, this way sounds better. Let me address it soon!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just submitted #39783.
This should be simplified back to self.assertRaises(IllegalArgumentException, lambda: self.spark.range(1).sample(-1.0))
after that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as is for now. I think we should fix the exceptions in Spark Connect in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. Merged to master/3.4. Thank you all!
…est_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 <ruifengz@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org> (cherry picked from commit 2fa1d6b) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
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