Github user aarondav commented on a diff in the pull request:
https://github.com/apache/spark/pull/158#discussion_r11308833
--- Diff: core/src/main/scala/org/apache/spark/storage/StorageLevel.scala
---
@@ -30,45 +31,54 @@ import java.io.{Externalizable, IOException,
ObjectInput, ObjectOutput}
class StorageLevel private(
private var useDisk_ : Boolean,
private var useMemory_ : Boolean,
+ private var useOffHeap_ : Boolean,
private var deserialized_ : Boolean,
private var replication_ : Int = 1)
extends Externalizable {
// TODO: Also add fields for caching priority, dataset ID, and flushing.
private def this(flags: Int, replication: Int) {
- this((flags & 4) != 0, (flags & 2) != 0, (flags & 1) != 0, replication)
+ this((flags & 8) != 0, (flags & 4) != 0, (flags & 2) != 0, (flags & 1)
!= 0, replication)
}
- def this() = this(false, true, false) // For deserialization
+ def this() = this(false, true, false, false) // For deserialization
def useDisk = useDisk_
def useMemory = useMemory_
+ def useOffHeap = useOffHeap_
def deserialized = deserialized_
def replication = replication_
assert(replication < 40, "Replication restricted to be less than 40 for
calculating hashcodes")
+
+ assert(!(useOffHeap && (replication > 1)),
--- End diff --
Let's make this a require() since it should always be performed at runtime.
We also don't support using disk, memory, or deserialized when offheap is set,
so I think a fuller check would look something like
```
if (useOffheap) {
require(useDisk == false, "Off-heap storage level does not support using
disk")
require(useMemory == false, "Off-heap storage level does not support
using heap memory")
require(deserialized == false, "Off-heap storage level does not support
deserialized storage")
require(replication == 1, "Off-heap storage level does not support
multiple replication")
}
```
and we can remove some of these in the future when they're actually
supported.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---