[ 
https://issues.apache.org/jira/browse/SPARK-49592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Neil Ramaswamy resolved SPARK-49592.
------------------------------------
    Resolution: Not A Bug

> 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]

Reply via email to