HyukjinKwon commented on code in PR #45023:
URL: https://github.com/apache/spark/pull/45023#discussion_r1477703771
##########
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:
It shouldn't actually use plain python type hints here but a description of
the types (see the example in
https://numpydoc.readthedocs.io/en/latest/format.html#parameters). It should be
something like ``` sequence of :class:`InputPartition` ```
--
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]