Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-37154][PYTHON] Inline hints for pyspark.rdd #35252
[SPARK-37154][PYTHON] Inline hints for pyspark.rdd #35252
Changes from 5 commits
87e997e
023f424
1391f58
2a37b86
f49b55f
ee99a79
c4c0eeb
87a97df
4708a68
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
These are added to clearly indicate which calls can result in
None
and, in turn, avoid ignores or casts inrdd.py
.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.
qq: Maybe that is a stupid question, but I'd like to ask if
def get(self, key: str, defaultValue: Optional[str]) -> Optional[str]:
can't cover the both
def get(self, key: str, defaultValue: None) -> Optional[str]:
and
def get(self, key: str, defaultValue: str) -> str:
??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.
It covers both, but doesn't capture the same relationship between arguments. With
(SparkConf, str, str) -> str
we know thatis
str
, which saves as cast / ignores / asserts not None later.With only
(SparkConf, str, Optional[str]) -> Optional[str]
we still have to assert that result is notNone
.(There might be other way of capturing this through type parameters, i.e.
(SparkConf, str, T) -> T
whereT
isTypeVar("T", None, str)
)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.
We use
range
inrdd.py
, so we need generic type of collection.