我从一个教程中创建了一个自己的UDTF函数,并将jar加载到hive中。现在,我想创建自己的函数来调用UDTF。
statement.executeUpdate("ADD JAR /home/hfu/myjar.jar;");
statement.executeUpdate("CREATE TEMPORARY FUNCTION my_function AS 'com.effectivemeasure.hive.UDFT'");当我运行最后一个CodeSnippet时,会得到一个异常:
Exception in thread "main" java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:296)
at org.apache.hive.jdbc.HiveStatement.executeUpdate(HiveStatement.java:406)
at connectToHiveServer2.main(connectToHiveServer2.java:74)我做错什么了?
以下是我使用的教程:
http://beekeeperdata.com/posts/hadoop/2015/07/26/Hive-UDTF-Tutorial.html和http://www.ericlin.me/hive-user-defined-aggregation-function-udaf
发布于 2015-11-25 00:15:03
我猜您正试图通过JDBC使用UDF。尝试以下几点:
第三条值得一提。当您执行来自shell的hive查询时,您的hive将将UDTF与其他hive一起打包,并将其作为hadoop作业提交。当使用jdbc时,这个工作是由hive服务器完成的,因此JAR必须存储在该路径中,而是存储在hive服务器上,这可能不是运行程序所用的同一台机器。
https://stackoverflow.com/questions/33846451
复制相似问题