Skip to content
Snippets Groups Projects
Commit 74ba9522 authored by Daoyuan Wang's avatar Daoyuan Wang Committed by Cheng Lian
Browse files

[SPARK-11311][SQL] spark cannot describe temporary functions

When describe temporary function, spark would return 'Unable to find function', this is not right.

Author: Daoyuan Wang <daoyuan.wang@intel.com>

Closes #9277 from adrian-wang/functionreg.
parent 767522dc
No related branches found
No related tags found
No related merge requests found
......@@ -119,7 +119,11 @@ private[hive] class HiveFunctionRegistry(underlying: analysis.FunctionRegistry)
annotation.value(),
annotation.extended()))
} else {
None
Some(new ExpressionInfo(
info.getFunctionClass.getCanonicalName,
name,
null,
null))
}
}.getOrElse(None))
}
......
......@@ -953,6 +953,16 @@ class HiveQuerySuite extends HiveComparisonTest with BeforeAndAfter {
sql("DROP TABLE t1")
}
test("CREATE TEMPORARY FUNCTION") {
val funcJar = TestHive.getHiveFile("TestUDTF.jar").getCanonicalPath
sql(s"ADD JAR $funcJar")
sql(
"""CREATE TEMPORARY FUNCTION udtf_count2 AS
| 'org.apache.spark.sql.hive.execution.GenericUDTFCount2'""".stripMargin)
assert(sql("DESCRIBE FUNCTION udtf_count2").count > 1)
sql("DROP TEMPORARY FUNCTION udtf_count2")
}
test("ADD FILE command") {
val testFile = TestHive.getHiveFile("data/files/v1.txt").getCanonicalFile
sql(s"ADD FILE $testFile")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment