From 31a7daba6b7e76811e6a5c1960b2aa27706fb316 Mon Sep 17 00:00:00 2001 From: Reynold Xin Date: Wed, 21 Nov 2012 17:30:20 -0800 Subject: [PATCH] Allow spilling cached tables to disk. --- src/main/scala/shark/CacheManager.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/scala/shark/CacheManager.scala b/src/main/scala/shark/CacheManager.scala index bad10629..64406979 100755 --- a/src/main/scala/shark/CacheManager.scala +++ b/src/main/scala/shark/CacheManager.scala @@ -1,6 +1,7 @@ package shark import spark.RDD +import spark.storage.StorageLevel import scala.collection.mutable.HashMap @@ -13,7 +14,7 @@ case class CacheKey(val keyStr: String) { case _ => false } } - + override def hashCode(): Int = { key.hashCode() } @@ -25,7 +26,7 @@ class CacheManager { def put(key: CacheKey, rdd: RDD[_]) { keyToRdd(key) = rdd - rdd.cache() + rdd.persist(StorageLevel.MEMORY_AND_DISK) } def get(key: CacheKey): Option[RDD[_]] = { @@ -34,7 +35,7 @@ class CacheManager { case None => None } } - + /** * Find all keys that are strings. Used to drop tables after exiting. */