Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/docs/source/tutorial/sql/python_data_source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ This is a dummy streaming data reader that generates 2 rows in every microbatch.
"""
return {"offset": 0}

def latestOffset(self) -> dict:
def latestOffset(self, start: dict, limit) -> dict:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably should add the type of limit too here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

"""
Return the current latest offset that the next microbatch will read to.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/sql/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def latestOffset(self, start: dict, limit: ReadLimit) -> dict:
... if isinstance(limit, ReadAllAvailable):
... return {"index": start["index"] + 10}
... else: # e.g., limit is ReadMaxRows(5)
... return {"index": start["index"] + min(10, limit.maxRows)}
... return {"index": start["index"] + min(10, limit.max_rows)}
"""
# NOTE: Previous Spark versions didn't have start offset and read limit parameters for this
# method. While Spark will ensure the backward compatibility for existing data sources, the
Expand Down