Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ private[hive] class HiveFunctionRegistry(underlying: analysis.FunctionRegistry)
annotation.value(),
annotation.extended()))
} else {
None
Some(new ExpressionInfo(
info.getFunctionClass.getCanonicalName,
name,
null,
null))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When will we hit this branch? For Hive UDFs, this fixes the problem because UDFs do not have annotation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we register a function using create function xx as "org.....", sometimes there's no annotation, but spark would complain could not find this function.

}
}.getOrElse(None))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,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")
Expand Down