[英]Hive UDF class not found
I need an auto-incrementing integer column in Hive and stumbled across UDFRowSequence . 我在Hive中需要一个自动递增的整数列,并在UDFRowSequence中偶然发现。
I created a Maven project in IntelliJ, added the .java
file, and let the IDE import the dependencies. 我在IntelliJ中创建了一个Maven项目,添加了
.java
文件,然后让IDE导入依赖项。 I then ran mvn package
, copied the resulting .jar
to a cluster node, and added the .jar
resource in Hive: 然后,我运行
mvn package
,将生成的.jar
复制到群集节点,然后在Hive中添加.jar
资源:
hive> add file udf-row-sequence-1.0-SNAPSHOT.jar;
Added resources: [udf-row-sequence-1.0-SNAPSHOT.jar]
Unfortunately, I'm unable to create the temporary function: 不幸的是,我无法创建临时功能:
hive> create temporary function row_sequence as 'com.alexwoolford.hive.udf.UDFRowSequence';
FAILED: Class com.alexwoolford.hive.udf.UDFRowSequence not found
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask
And yet, if I look at the contents of the .jar
file I can see that the class exists: 但是,如果查看
.jar
文件的内容,我可以看到该类存在:
jar tf udf-row-sequence-1.0-SNAPSHOT.jar
[...]
com/alexwoolford/hive/udf/UDFRowSequence.class
[...]
Can you see what I'm doing wrong? 你能看到我做错了吗?
该问题是由使用add file
而不是add jar
,即
add jar udf-row-sequence-1.0-SNAPSHOT.jar;
Even though you do "ADD JAR", sometimes even order of adding the JARS do matter, I faced this issue while adding ESRI Hive UDF jars. 即使您执行“ ADD JAR”,有时甚至添加JARS的顺序也很重要,但是在添加ESRI Hive UDF jar时,我遇到了这个问题。
add jar esri-geometry-api-1.2.jar;
add jar spatial-sdk-hive-1.0.3-SNAPSHOT.jar;
works 作品
add jar spatial-sdk-hive-1.0.3-SNAPSHOT.jar;
add jar esri-geometry-api-1.2.jar;
Doesn't work 不起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.