Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/11613#discussion_r55897722 --- Diff: core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala --- @@ -520,3 +447,42 @@ private[spark] class MemoryStore( logMemoryUsage() } } + +/** + * The result of a failed [[MemoryStore.putIterator()]] call. + * + * @param memoryStore the memoryStore, used for freeing memory. + * @param unrollMemory the amount of unroll memory used by the values in `unrolled`. + * @param unrolled an iterator for the partially-unrolled values. + * @param rest the rest of the original iterator passed to [[MemoryStore.putIterator()]]. + */ +private[storage] class PartiallyUnrolledIterator( + memoryStore: MemoryStore, + unrollMemory: Long, + unrolled: Iterator[Any], + rest: Iterator[Any]) + extends Iterator[Any] { + + private[this] var unrolledIteratorIsCompleted: Boolean = false + private[this] var iter: Iterator[Any] = { + val completionIterator = CompletionIterator[Any, Iterator[Any]](unrolled, { + unrolledIteratorIsCompleted = true + memoryStore.releaseUnrollMemoryForThisTask(unrollMemory) + }) + completionIterator ++ rest --- End diff -- Yep, that's right.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org