我有一個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感謝它爲我工作:-) –