[SPARK-55851][PYTHON] Clarify types of datasource partition and read#54635
Open
gaogaotiantian wants to merge 6 commits intoapache:masterfrom
Open
[SPARK-55851][PYTHON] Clarify types of datasource partition and read#54635gaogaotiantian wants to merge 6 commits intoapache:masterfrom
gaogaotiantian wants to merge 6 commits intoapache:masterfrom
Conversation
Contributor
Author
|
Need approval from @allisonwang-db :) |
zhengruifeng
approved these changes
Mar 5, 2026
allisonwang-db
approved these changes
Mar 5, 2026
Contributor
allisonwang-db
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
HyukjinKwon
approved these changes
Mar 6, 2026
Contributor
Author
|
Okay we need some further discussion on this matter. The problem is streaming. streaming has slightly different logic. Who do we need to confirm about what the expected behavior is for streaming data source? In an ideal world, streaming data source should have the exact same interface as non-streaming one. So |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
Clarify and unify the types of datasource partition/read function.
partitionto make it match the documentation.Why are the changes needed?
Our current type hint for
partitionandreadis wrong. We do acceptNoneas a partition in our code but we did not mention it. This will confuse users as this is documented and user facing.We also says the default behavior for
partitionis to return a list withNone- but we didn't do that. Instead, we used a very convoluted approach - raise an exception, catch that in the worker and convert that to[None]. That's super unnecessary.This change should not affect users if they already overwrite their
partitionandreadmethod. (unless they overwrite with a function that raisesNotImplementedError).Overall this gives us a more consistent interface with correct typing.
Does this PR introduce any user-facing change?
Basically no. Unless user does something crazy.
How was this patch tested?
CI
Was this patch authored or co-authored using generative AI tooling?
No.