我有一个Hive Udf在hive终端中运行良好,我想通过shell脚本执行它。 在蜂巢终端,我能够执行下面的命令:通过shell脚本配置单元udf执行
use mashery_db;
add jar hdfs://nameservice1/tmp/nextdata_aggregations/custom_jar/readerCheck.jar;
add file hdfs://nameservice1/tmp/GeoLite2-City.mmdb;
CREATE TEMPORARY FUNCTION geoip AS 'com.mashery.nextdata.hive.udf.GeoIPGenericUDF';
但是,当我加入的shell脚本上面的代码
hive -e "use mashery_db;"
hive -e "add jar hdfs://nameservice1/tmp/nextdata_aggregations/custom_jar/readerCheck.jar;"
hive -e "add file hdfs://nameservice1/tmp/GeoLite2-City.mmdb;"
hive -e "CREATE TEMPORARY FUNCTION geoip AS 'com.mashery.nextdata.hive.udf.GeoIPGenericUDF';"
首届“蜂巢-e”运作良好,并增加了罐子但最后一个创建临时功能不起作用。我得到以下错误:
FAILED: ParseException line 1:35 mismatched input 'com' expecting StringLiteral near 'AS' in create function statement
我也曾尝试用单引号
hive -e "CREATE TEMPORARY FUNCTION geoip AS 'com.mashery.nextdata.hive.udf.GeoIPGenericUDF';"
然后我得到FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask
FAILED: Class com.mashery.nextdata.hive.udf.GeoIPGenericUDF not found
是否不亦乐乎UDF支持shell脚本,如果这样做什么我正在做错。在此先感谢
尝试导入jar并创建一个调用蜂巢的函数。即'hive -e'添加jar path_to_jar/foo.jar;创建临时函数foo作为'com.package.UDF';'' – gobrewers14
@ GoBrewers14感谢它为我工作:-) –