[SPARK-56367][SS][PYTHON][DOCS] Fix latestOffset docstring and tutorial to use correct field name and signature#55227
Draft
jiteshsoni wants to merge 1 commit intoapache:masterfrom
Conversation
…al to use correct field name and signature ### What changes were proposed in this pull request? This PR fixes two documentation bugs in PySpark's streaming data source API: 1. **Docstring attribute error** (`datasource.py`): The `DataSourceStreamReader.latestOffset()` docstring example incorrectly referenced `limit.maxRows` when it should be `limit.max_rows`. The `ReadMaxRows` dataclass uses Python snake_case convention. 2. **Outdated method signature** (`python_data_source.rst`): The tutorial's `FakeStreamReader` example showed the deprecated parameterless signature `def latestOffset(self)` instead of the recommended signature with admission control support: `def latestOffset(self, start: dict, limit)`. ### Why are the changes needed? - Users copying the docstring example would encounter an `AttributeError` at runtime due to the incorrect attribute name. - Tutorial users wouldn't learn about the `start` offset parameter or admission control capabilities introduced in SPARK-55304. ### Does this PR introduce _any_ user-facing change? No. This is a documentation-only fix. ### How was this patch tested? Documentation changes only - no tests required. ### Was this patch authored or co-authored using generative AI tooling? Yes, GitHub Copilot and Claude Code were used to assist with this patch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| return {"offset": 0} | ||
|
|
||
| def latestOffset(self) -> dict: | ||
| def latestOffset(self, start: dict, limit) -> dict: |
Contributor
There was a problem hiding this comment.
Probably should add the type of limit too here.
Contributor
Author
There was a problem hiding this comment.
My bad, this was not ready for review yet.
Give me a couple of days, and I will test this and bring this PR out of draft status.
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?
This PR fixes two documentation bugs in PySpark's streaming data source API:
Docstring attribute error (
datasource.py): TheDataSourceStreamReader.latestOffset()docstring example incorrectly referencedlimit.maxRowswhen it should belimit.max_rows. TheReadMaxRowsdataclass uses Python snake_case convention.Outdated method signature (
python_data_source.rst): The tutorial'sFakeStreamReaderexample showed the deprecated parameterless signaturedef latestOffset(self)instead of the recommended signature with admission control support:def latestOffset(self, start: dict, limit).Why are the changes needed?
AttributeErrorat runtime due to the incorrect attribute name.startoffset parameter or admission control capabilities introduced in SPARK-55304.Does this PR introduce any user-facing change?
No. This is a documentation-only fix.
How was this patch tested?
Documentation changes only - no tests required.
Was this patch authored or co-authored using generative AI tooling?
Yes, GitHub Copilot and Claude Code were used to assist with this patch.