在hive 0.13中没有找到类Kryo异常 - Hadoop

时间:2014-10-11 00:56:36

标签: hadoop hive kryo

我有一个GenericUDF(见下面的代码)在Hadoop-1和Hive-0.12上正常运行。但是当使用Hive-0.13 + Hadoop-2测试相同的GenericUDF时,我收到以下错误。

  

顶点失败,vertexName = Map 12,vertexId = vertex_1409698731658_42202_1_00,diagnostics = [顶点输入:ccv初始化程序失败。,org.apache.hive.com.esotericsoftware.kry   o.KryoException:无法找到类:com.xxx.xxx.Id1

以下是我的UDF的代码。

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有关,但无法查看与此错误相关的任何帖子。

0 个答案:

没有答案