Github user jose-torres commented on a diff in the pull request:
https://github.com/apache/spark/pull/20097#discussion_r159480191
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MicroBatchExecution.scala
---
@@ -236,14 +257,31 @@ class MicroBatchExecution(
val hasNewData = {
awaitProgressLock.lock()
try {
- val latestOffsets: Map[Source, Option[Offset]] = uniqueSources.map
{
+ val latestOffsets: Map[BaseStreamingSource, Option[Offset]] =
uniqueSources.map {
case s: Source =>
updateStatusMessage(s"Getting offsets from $s")
reportTimeTaken("getOffset") {
(s, s.getOffset)
}
+ case s: MicroBatchReader =>
+ updateStatusMessage(s"Getting offsets from $s")
+ reportTimeTaken("getOffset") {
+ // Once v1 streaming source execution is gone, we can
restructure this to be cleaner.
+ // For now, we set the range here to get the available end
offset, and set it again
+ // for real when executing.
+ if (availableOffsets.get(s).isDefined) {
+ val offsetJson = availableOffsets.get(s).get.json
+ s.setOffsetRange(
+ Optional.of(s.deserializeOffset(offsetJson)),
--- End diff --
If we want a conversion, I'd prefer to pull in scala-java8-compat, rather
than roll our own we'd inevitably have to replace. (But that module is marked
experimental, so maybe that's not the right tradeoff.)
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]