diff options
author | Michael Armbrust <michael@databricks.com> | 2015-01-10 14:25:45 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-01-10 14:25:45 -0800 |
commit | 3684fd21e1ffdc0adaad8ff6b31394b637e866ce (patch) | |
tree | ad77ec2fd9776e57d4f76837730d89d78b93d783 /sql | |
parent | 77106df69147aba5eb1784adb84e2b574927c6de (diff) | |
download | spark-3684fd21e1ffdc0adaad8ff6b31394b637e866ce.tar.gz spark-3684fd21e1ffdc0adaad8ff6b31394b637e866ce.tar.bz2 spark-3684fd21e1ffdc0adaad8ff6b31394b637e866ce.zip |
[SPARK-5187][SQL] Fix caching of tables with HiveUDFs in the WHERE clause
Author: Michael Armbrust <michael@databricks.com>
Closes #3987 from marmbrus/hiveUdfCaching and squashes the following commits:
8bca2fa [Michael Armbrust] [SPARK-5187][SQL] Fix caching of tables with HiveUDFs in the WHERE clause
Diffstat (limited to 'sql')
3 files changed, 8 insertions, 2 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala index 2060e1f1a7..f95a6b43af 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala @@ -158,4 +158,10 @@ class CachedTableSuite extends QueryTest { uncacheTable("src") assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted") } + + test("CACHE TABLE with Hive UDF") { + sql("CACHE TABLE udfTest AS SELECT * FROM src WHERE floor(key) = 1") + assertCached(table("udfTest")) + uncacheTable("udfTest") + } } diff --git a/sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala b/sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala index 2d01a85067..25fdf5c5f3 100644 --- a/sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala +++ b/sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala @@ -44,7 +44,7 @@ import scala.language.implicitConversions import org.apache.spark.sql.catalyst.types.DecimalType -class HiveFunctionWrapper(var functionClassName: String) extends java.io.Serializable { +case class HiveFunctionWrapper(functionClassName: String) extends java.io.Serializable { // for Serialization def this() = this(null) diff --git a/sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala b/sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala index b78c75798e..e47002cb0b 100644 --- a/sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala +++ b/sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala @@ -53,7 +53,7 @@ import scala.language.implicitConversions * * @param functionClassName UDF class name */ -class HiveFunctionWrapper(var functionClassName: String) extends java.io.Externalizable { +case class HiveFunctionWrapper(var functionClassName: String) extends java.io.Externalizable { // for Serialization def this() = this(null) |