Pregunta

Estoy usando "Hadoop-0.20.203.0rc1.tar.gz" para mi configuración de clúster. Siempre que me ponga job.setMapOutputKeyClass(ByteBuffer.class);

Y ejecute el trabajo que obtengo la siguiente excepción:

    12/01/13 15:09:00 INFO mapred.JobClient: Task Id : attempt_201201131428_0005_m_000001_2, Status : FAILED
java.lang.ClassCastException: class java.nio.ByteBuffer
        at java.lang.Class.asSubclass(Class.java:3018)
        at org.apache.hadoop.mapred.JobConf.getOutputKeyComparator(JobConf.java:776)
        at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.<init>(MapTask.java:958)
        at org.apache.hadoop.mapred.MapTask$NewOutputCollector.<init>(MapTask.java:673)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:755)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:369)
        at org.apache.hadoop.mapred.Child$4.run(Child.java:259)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:396)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
        at org.apache.hadoop.mapred.Child.main(Child.java:253)

También he notado que Bytebuffer es comparable y no es escrito, ¿eso hace alguna diferencia? Avíseme si se necesita información adicional.

¿Fue útil?

Solución

Aquí es donde se lanza la excepción. Aquí está el código de Svn.

public RawComparator getOutputKeyComparator() {
    Class<? extends RawComparator> theClass = getClass("mapred.output.key.comparator.class",
        null, RawComparator.class);
    if (theClass != null)
        return ReflectionUtils.newInstance(theClass, this);
    return WritableComparator.get(getMapOutputKeyClass().asSubclass(WritableComparable.class));
}

Si mapred.output.key.comparator.class La propiedad no se define en JobConf, entonces la clave debe implementar la interfaz WRITABLECOMPARABLE. Bytebuffer Class no implementa la interfaz WRITABLECOMPARABLE, por lo que la excepción.

POR CIERTO, WRITABLECOMPARABLE La interfaz es subinterfaz de clases de escritura y comparables.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top