Skip to content

Commit cce003d

Browse files
committed
[SPARK-5187][SQL] Fix caching of tables with HiveUDFs in the WHERE clause
Author: Michael Armbrust <[email protected]> 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 3684fd2) Signed-off-by: Michael Armbrust <[email protected]>
1 parent c6ea6d4 commit cce003d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/CachedTableSuite.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,10 @@ class CachedTableSuite extends QueryTest {
158158
uncacheTable("src")
159159
assert(!isMaterialized(rddId), "Uncached in-memory table should have been unpersisted")
160160
}
161+
162+
test("CACHE TABLE with Hive UDF") {
163+
sql("CACHE TABLE udfTest AS SELECT * FROM src WHERE floor(key) = 1")
164+
assertCached(table("udfTest"))
165+
uncacheTable("udfTest")
166+
}
161167
}

sql/hive/v0.12.0/src/main/scala/org/apache/spark/sql/hive/Shim12.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import scala.language.implicitConversions
4343

4444
import org.apache.spark.sql.catalyst.types.DecimalType
4545

46-
class HiveFunctionWrapper(var functionClassName: String) extends java.io.Serializable {
46+
case class HiveFunctionWrapper(functionClassName: String) extends java.io.Serializable {
4747
// for Serialization
4848
def this() = this(null)
4949

sql/hive/v0.13.1/src/main/scala/org/apache/spark/sql/hive/Shim13.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import scala.language.implicitConversions
5252
*
5353
* @param functionClassName UDF class name
5454
*/
55-
class HiveFunctionWrapper(var functionClassName: String) extends java.io.Externalizable {
55+
case class HiveFunctionWrapper(var functionClassName: String) extends java.io.Externalizable {
5656
// for Serialization
5757
def this() = this(null)
5858

0 commit comments

Comments
 (0)