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:57 -0800 |
commit | cce003d7533f8c767e9f7350f869b1ac7bb3ac22 (patch) | |
tree | 42b11460019eaccd26df392ccbec11c5a860e91f | |
parent | c6ea6d4b7dfb7cad440025b13a584d5200a4ef8f (diff) | |
download | spark-cce003d7533f8c767e9f7350f869b1ac7bb3ac22.tar.gz spark-cce003d7533f8c767e9f7350f869b1ac7bb3ac22.tar.bz2 spark-cce003d7533f8c767e9f7350f869b1ac7bb3ac22.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
(cherry picked from commit 3684fd21e1ffdc0adaad8ff6b31394b637e866ce)
Signed-off-by: Michael Armbrust <michael@databricks.com>
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 754ffc4220..50e88ced4f 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 @@ -43,7 +43,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 7c8cbf10c1..ed688264f4 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 @@ -52,7 +52,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) |