spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mateiz <...@git.apache.org>
Subject [GitHub] spark pull request: Patch for SPARK-942
Date Mon, 03 Mar 2014 05:50:25 GMT
Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/50#discussion_r10201268
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala ---
    @@ -549,34 +555,43 @@ private[spark] class BlockManager(
     
           var marked = false
           try {
    -        data match {
    -          case Left(values) => {
    -            if (level.useMemory) {
    -              // Save it just to memory first, even if it also has useDisk set to true;
we will
    -              // drop it to disk later if the memory store can't hold it.
    -              val res = memoryStore.putValues(blockId, values, level, true)
    -              size = res.size
    -              res.data match {
    -                case Right(newBytes) => bytesAfterPut = newBytes
    -                case Left(newIterator) => valuesAfterPut = newIterator
    -              }
    -            } else {
    -              // Save directly to disk.
    -              // Don't get back the bytes unless we replicate them.
    -              val askForBytes = level.replication > 1
    -              val res = diskStore.putValues(blockId, values, level, askForBytes)
    -              size = res.size
    -              res.data match {
    -                case Right(newBytes) => bytesAfterPut = newBytes
    -                case _ =>
    -              }
    +        if (level.useMemory) {
    +          // Save it just to memory first, even if it also has useDisk set to true; we
will
    +          // drop it to disk later if the memory store can't hold it.
    +          val res = data match {
    +            case IteratorValues(values_i) =>
    +              memoryStore.putValues(blockId, values_i, level, true)
    +            case ArrayBufferValues(values_a) =>
    +              memoryStore.putValues(blockId, values_a, level, true)
    +            case ByteBufferValues(value_bytes) => {
    +              value_bytes.rewind();
    +              memoryStore.putBytes(blockId, value_bytes, level)
    +            }
    +          }
    +          size = res.size
    +          res.data match {
    +            case Right(newBytes) => bytesAfterPut = newBytes
    +            case Left(newIterator) => valuesAfterPut = newIterator
    +          }
    +        } else {
    +          // Save directly to disk.
    +          // Don't get back the bytes unless we replicate them.
    +          val askForBytes = level.replication > 1
    +
    +          val res = data match {
    +            case IteratorValues(values_i) =>
    --- End diff --
    
    Ditto on the variable names here


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message