我有一个genericudf(见下面的代码),它在hadoop-1和hive-0.12上运行良好。但是当使用hive-0.13+hadoop-2测试相同的genericudf时,我得到了以下错误。
vertex失败,vertexname=map 12,vertexid=vertex\u 1409698731658\u 42202\u 1\u 00,diagnostics=[顶点输入:ccv初始值设定项失败,org.apache.hive.com.esotericsoftware.kry o.kryoexception:找不到类:com...id1
这是我的自定义项代码。
package com.xxx.xxx;
import org.apache.hadoop.hive.*;
public class Id1 extends GenericUDF {
private MapredContext context;
private long sequenceNum = 0;
private static final int padLength = 10;
StringBuilder sb = null;
public ObjectInspector initialize(ObjectInspector[] arguments)
throws UDFArgumentException {
sequenceNum = 0;
sb = new StringBuilder();
return PrimitiveObjectInspectorFactory.javaStringObjectInspector;
}
public Object evaluate(DeferredObject[] arguments) throws HiveException {
int sbLength = sb.toString().length();
if (sbLength > 0)
sb.replace(0, sbLength, "");
String taskId = null;
if (context.getJobConf() != null)
taskId = context.getJobConf().get("mapred.taskid");
sequenceNum++;
if (taskId != null) {
sb.append(taskId.replace("attempt_", ""));
}
int i = 0;
String seqStr = String.valueOf(sequenceNum);
sb.append(seqStr);
return sb.toString();
}
public String getDisplayString(String[] children) {
return "id1()";
}
@Override
public void configure(MapredContext context) {
this.context = context;
}
}
我确信这与hive-0.13有关,但看不到任何与此错误相关的帖子。
暂无答案!
目前还没有任何答案,快来回答吧!