Repository: spark
Updated Branches:
  refs/heads/branch-1.2 c6ea6d4b7 -> cce003d75


[SPARK-5187][SQL] Fix caching of tables with HiveUDFs in the WHERE clause

Author: Michael Armbrust <mich...@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 <mich...@databricks.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/cce003d7
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/cce003d7
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/cce003d7

Branch: refs/heads/branch-1.2
Commit: cce003d7533f8c767e9f7350f869b1ac7bb3ac22
Parents: c6ea6d4
Author: Michael Armbrust <mich...@databricks.com>
Authored: Sat Jan 10 14:25:45 2015 -0800
Committer: Michael Armbrust <mich...@databricks.com>
Committed: Sat Jan 10 14:25:57 2015 -0800

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/hive/CachedTableSuite.scala     | 6 ++++++
 .../src/main/scala/org/apache/spark/sql/hive/Shim12.scala      | 2 +-
 .../src/main/scala/org/apache/spark/sql/hive/Shim13.scala      | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/cce003d7/sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala
----------------------------------------------------------------------
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 2060e1f..f95a6b4 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")
+  }
 }

http://git-wip-us.apache.org/repos/asf/spark/blob/cce003d7/sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala
----------------------------------------------------------------------
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 754ffc4..50e88ce 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)
 

http://git-wip-us.apache.org/repos/asf/spark/blob/cce003d7/sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala
----------------------------------------------------------------------
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 7c8cbf1..ed68826 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)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to