Skip to content

Commit

Permalink
fix serialization suite
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed May 6, 2015
1 parent 81711c4 commit 5fe5894
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {

val describedTable = "DESCRIBE (\\w+)".r

@transient
val vs = new VariableSubstitution()

// we should substitute variables in hql to pass the text to parseSql() as a parameter.
Expand Down Expand Up @@ -203,6 +204,7 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
* A list of test tables and the DDL required to initialize them. A test table is loaded on
* demand when a query are run against it.
*/
@transient
lazy val testTables = new mutable.HashMap[String, TestTable]()

def registerTestTable(testTable: TestTable): Unit = {
Expand All @@ -212,6 +214,7 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
// The test tables that are defined in the Hive QTestUtil.
// /itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
// https://github.com/apache/hive/blob/branch-0.13/data/scripts/q_test_init.sql
@transient
val hiveQTestUtilTables = Seq(
TestTable("src",
"CREATE TABLE src (key INT, value STRING)".cmd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import org.apache.spark.sql.hive.test.TestHive
class SerializationSuite extends FunSuite {

test("[SPARK-5840] HiveContext should be serializable") {
val hiveContext = new HiveContext(TestHive.sparkContext)
val hiveContext = TestHive
hiveContext.hiveconf
new JavaSerializer(new SparkConf()).newInstance().serialize(hiveContext)
val serializer = new JavaSerializer(new SparkConf()).newInstance()
val bytes = serializer.serialize(hiveContext)
val deSer = serializer.deserialize[AnyRef](bytes)
}
}

0 comments on commit 5fe5894

Please sign in to comment.