Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/15307#discussion_r83109360
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala
---
@@ -278,8 +315,14 @@ class StreamExecution(
val hasNewData = {
awaitBatchLock.lock()
try {
- val newData = uniqueSources.flatMap(s => s.getOffset.map(o => s ->
o))
- availableOffsets ++= newData
+ reportTimeTaken(GET_OFFSET_LATENCY) {
+ val latestOffsets: Map[Source, Option[Offset]] =
uniqueSources.map { s =>
+ reportTimeTaken(s, SOURCE_GET_OFFSET_LATENCY) {
+ (s, s.getOffset)
+ }
+ }.toMap
+ availableOffsets ++= latestOffsets.filter { case (s, o) =>
o.nonEmpty }.mapValues(_.get)
+ }
--- End diff --
It can be added, but there are updateStatus() is runBatches() right after
constructNextBatch().
The rule is that this can be called anytime there is any significant change
in status (offsets, metrics, etc.) that should be made visible externally. As
long as this is called from the StreamExecution thread, it is fine to call it
any where.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]