You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Jungtaek Lim (Jira)" <ji...@apache.org> on 2026/10/21 20:43:00 UTC

[jira] [Resolved] (SPARK-60359) EvictionIterator removes state rows in hasNext instead of next

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

Jungtaek Lim resolved SPARK-60359.
----------------------------------
    Fix Version/s: 4.4.0
       Resolution: Fixed

Issue resolved by pull request 59608
[https://github.com/apache/spark/pull/59608]

> EvictionIterator removes state rows in hasNext instead of next
> --------------------------------------------------------------
>
>                 Key: SPARK-60359
>                 URL: https://issues.apache.org/jira/browse/SPARK-60359
>             Project: Spark
>          Issue Type: Bug
>          Components: Structured Streaming
>    Affects Versions: 4.4.0
>            Reporter: Min Yang
>            Assignee: Min Yang
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.4.0
>
>
> EvictionIterator (used by StreamingAggregationStateManager.evictionIterator and StatefulStreamlineAggregateExec) removes an evictable row from the state store, and increments numRowsRemovedSoFar, inside hasNext. A caller that calls hasNext without a matching next() therefore deletes a row it never received.
> Consequences:
> - Append mode emits evicted rows and counts numRowsRemovedSoFar as numOutputRows. If the consumer stops after a hasNext probe, the probed row is deleted from state but never emitted, and is still counted as output.
> - Update mode incremental cleanup has to re-check its removal budget before every hasNext to avoid removing one extra row per input.
> The iterator should only find the next evictable row in hasNext, and remove it (and update the metric) when next() returns it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org