Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/20097#discussion_r159555278
--- 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 --
Why would we have to replace inevitably?
And its just single line method that improves the cleanliness a lot. Really
no need to even consider pulling in scala-java8-compat for just that.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]