minyyy opened a new pull request, #59608: URL: https://github.com/apache/spark/pull/59608
### What changes were proposed in this pull request? Make `EvictionIterator` remove an evictable row (and increment `numRowsRemovedSoFar`) in `next()` instead of `hasNext`. `hasNext` still finds and buffers the next evictable row, but no longer mutates the state store. Docs on `EvictionIterator` and `StreamingAggregationStateManager.evictionIterator` are updated, and the now-obsolete note in `StatefulStreamlineAggregateExec` is removed. ### Why are the changes needed? `hasNext` should not have side effects. With removal in `hasNext`, a caller that probes without consuming deletes a row it never received: in append mode that row is dropped from state without being emitted yet is still counted in `numOutputRows`, and update-mode incremental cleanup has to order its checks carefully to avoid removing an extra row per input. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? New test in `StreamingAggregationStateManagerSuite` checking that repeated `hasNext` does not remove the row or update the metric, and `next()` does. Existing `StreamingAggregationStateManagerSuite` and `StreamingAggregationSuite` pass. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 This pull request and its description were written by Isaac. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
