-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-54619][PYTHON] Add a sanity check for configuration numbers #53359
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,7 +119,15 @@ def __init__(self, infile=None): | |
|
|
||
| def load(self, infile): | ||
| num_conf = read_int(infile) | ||
| for i in range(num_conf): | ||
| if num_conf < 0 or num_conf > 10000: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 10,000 seems to be too small though, @gaogaotiantian .
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, don't we already only send the allowed confs only? e.g.,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, okay so this is adding a sanity check |
||
| # We only have a few thousands configurations. This is a sanity check. | ||
| raise PySparkRuntimeError( | ||
| errorClass="PROTOCOL_ERROR", | ||
| messageParameters={ | ||
| "failure": f"Invalid number of configurations: {num_conf}", | ||
| }, | ||
| ) | ||
| for _ in range(num_conf): | ||
| k = utf8_deserializer.loads(infile) | ||
| v = utf8_deserializer.loads(infile) | ||
| self._conf[k] = v | ||
|
|
||
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.
Let's add a bit of background here in a comment. I was also wondering why we need this as we're already controlling the confs to send.