chaoqin-li1123 commented on code in PR #45023:
URL: https://github.com/apache/spark/pull/45023#discussion_r1479207581
##########
python/pyspark/sql/datasource.py:
##########
@@ -298,6 +305,90 @@ def read(self, partition: InputPartition) ->
Iterator[Union[Tuple, Row]]:
...
+class DataSourceStreamReader(ABC):
+ def initial_offset(self) -> dict:
+ """
+ The initial offset of the streaming data source.
+
+ Returns
+ -------
+ dict
+ A dict whose key and values are str type.
+ """
+ ...
+
+ def latest_offset(self) -> dict:
+ """
+ Seek the latest offset of the streaming data source.
+
+ Returns
+ -------
+ dict
+ A dict whose key and values are str type.
+ """
+ ...
+
+ def partitions(self, start: dict, end: dict) -> Sequence[InputPartition]:
+ """
+ Plan the read partitions given the start and end offset.
+
+ Parameters
+ ----------
+ start : dict
+ The start offset of the microbatch to plan partitioning.
+ end : dict
+ The end offset of the microbatch to plan partitioning.
+
+ Returns
+ -------
+ Sequence[InputPartition]
Review Comment:
Thanks, I feel it is probably cleaner to make separate change in another PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]