Skip to content
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

Closed

Conversation

zhengruifeng
Copy link
Contributor

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

@@ -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))
Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gentle ping, @itholic .

Copy link
Contributor

@itholic itholic Jan 28, 2023

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.

Copy link
Contributor

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.

@dongjoon-hyun
Copy link
Member

Could you rebase this PR, @zhengruifeng ? There is a conflict after merging your another PR in this area.

@zhengruifeng
Copy link
Contributor Author

@dongjoon-hyun Sure, thanks for the reviews of these test PRs!

fix

fix join type
Copy link
Contributor

@itholic itholic left a 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),
Copy link
Contributor

@itholic itholic Jan 28, 2023

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?

Copy link
Member

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?

Copy link
Contributor

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!

Copy link
Contributor

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.

Copy link
Member

@HyukjinKwon HyukjinKwon left a 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.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a 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!

dongjoon-hyun pushed a commit that referenced this pull request Jan 29, 2023
…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>
@zhengruifeng zhengruifeng deleted the connect_enable_41830 branch January 29, 2023 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants