Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/791#discussion_r12878553
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala ---
    @@ -243,10 +250,13 @@ private class MemoryStore(blockManager: BlockManager, 
maxMemory: Long)
             val iterator = entries.entrySet().iterator()
             while (maxMemory - (currentMemory - selectedMemory) < space && 
iterator.hasNext) {
               val pair = iterator.next()
    -          val blockId = pair.getKey
    -          if (rddToAdd.isEmpty || rddToAdd != getRddId(blockId)) {
    -            selectedBlocks += blockId
    -            selectedMemory += pair.getValue.size
    +          val entry = pair.getValue
    +          if (!entry.dropping) {
    +            val blockId = pair.getKey
    +            if (rddToAdd.isEmpty || rddToAdd != getRddId(blockId)) {
    +              selectedBlocks += blockId
    +              selectedMemory += entry.size
    --- End diff --
    
    I found I need `pair.getValue` twice, so I extract it into `val entry = 
pair.getValue` to save code lines. Is that 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.
---

Reply via email to