[SPARK-1201] Do not fully materialize partitions for MEMORY_*_SER

The deserialized version of a partition may occupy much more space than the serialized version. Therefore, if a partition is to be cached with `StorageLevel.MEMORY_*_SER`, we don't need to fully unroll it into an `ArrayBuffer`, but instead we can unroll it into a potentially much smaller `ByteBuffer`. This may save us from OOMs in this case.
This paragraph doesn't make a lot of sense to me. In general it is just unlikely for two threads to work on the same rdd partition. However, if we ever pass the first if (where it returns None), it already means we are in the "unlikely" case.