我试图注册一个HIVe UDF(如下所述),但最终出现错误。请告诉我在这种情况下该怎么办?
0:
jdbc:hive2://g4t7479.calfor.abbcorp.net:1> ADD JAR /MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar;
Error: Error while processing statement: /MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar does not exist (state=,code=1)
0: jdbc:hive2://g4t7479.calfor.abbcorp.net:1> CREATE TEMPORARY FUNCTION stringTrim as 'com.axx.gma.dclick.StringTrim' USING JAR 'hdfs://MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar';
Error: Error while compiling statement: FAILED: SemanticException java.lang.IllegalArgumentException: java.net.UnknownHostException: MAPR (state=42000,code=40000)
0: jdbc:hive2://g4t7479.calfor.abbcorp.net:1> CREATE TEMPORARY FUNCTION stringTrim as 'com.axx.gma.dclick.StringTrim' USING JAR 'hdfs:://MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar';
Error: Error while compiling statement: FAILED: IllegalArgumentException java.net.URISyntaxException: Relative path in absolute URI: hdfs::/MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar (state=42000,code=40000)
答案 0 :(得分:0)
错误:处理语句时出错:/MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar不存在(state =,code = 1)
以上错误消息表明jar未预先设置且尚未添加,因此使用该JAR创建函数肯定会给您错误。
使用以下命令检查JAR是否存在。如果您使用其他文件系统命令可能有所不同,则这将适用于hdfs。
hdfs dfs -ls /MAPR/DBLCLK/double_click/HiveUDF/AXX-DoubleClick-0.0.1-SNAPSHOT-jar-with-dependencies.jar
如果不是,则需要将文件从本地系统移至hdfs
文件系统。或将命令更改为ADD LOCAL JAR
(尽管这在beeline中无效)
即使添加JAR时没有出现任何错误,也最好使用以下命令(来自hive或beeline)来确保已添加它。
列出罐子;
这将显示所有已添加的jar。