[
https://issues.apache.org/jira/browse/SPARK-49592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881188#comment-17881188
]
Neil Ramaswamy commented on SPARK-49592:
----------------------------------------
After further consideration (see discussion on the PR), we have determined that
this is not a bug, but rather expected behavior. If anything, we should improve
the comments on the class in the future, since it is currently misleading (case
in point: the original authors originally thought this bug report was valid!).
> OperatorStateMetadataV2 can return incorrect metadata for the given batchId
> ---------------------------------------------------------------------------
>
> Key: SPARK-49592
> URL: https://issues.apache.org/jira/browse/SPARK-49592
> Project: Spark
> Issue Type: Improvement
> Components: Structured Streaming
> Affects Versions: 4.0.0
> Reporter: Neil Ramaswamy
> Priority: Major
> Labels: pull-request-available
>
> Currently, the `OperatorStateMetadataV2Reader` has an off-by-one error when
> reading metadata for a given batchId. The issue is on [this
> line|https://github.com/apache/spark/blob/ea4b82e97d944717b32aaaec986a8238e59b8acf/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/OperatorStateMetadata.scala#L349].
> Suppose the batches in the checkpoint location is just `0`, and the desired
> `batchId` is 1. The logic lists all of the batches, filters for less than
> `batchId`, and takes the last element. This can return the metadata for `0`,
> when really we want the metadata for `1`. The reason we didn't catch this
> before was because [this
> check|https://github.com/apache/spark/blob/ea4b82e97d944717b32aaaec986a8238e59b8acf/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/OperatorStateMetadata.scala#L316-L318]
> prevented us from getting to the point where we attempted to read metadata
> for a batch whose offset didn't yet exist.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]