0
При попытке оценить Spark для повторного использования существующих пользовательских форматов ввода из эпохи mapreduce я столкнулся с проблемой дженериков Java.Spark custom hadoop input format java generics error
import com.google.protobuf.Message;
import com.twitter.elephantbird.mapreduce.io.ProtobufWritable;
public abstract class AbstractInputFormat<K extends Message, V> extends FileInputFormat<ProtobufWritable<K>, V>
...
import com.example.MyProto; // this extends Message
public class MyInputFormat extends AbstractInputFormat<MyProto, Text>
...
SparkConf conf = new SparkConf().setAppName("Test");
SparkContext sc = new SparkContext(conf);
JavaSparkContext jsc = JavaSparkContext.fromSparkContext(sc);
JavaPairRDD myRdd = jsc.newAPIHadoopFile(logFile, MyInputFormat.class, ProtobufWritable.class, Text.class,
Job.getInstance().getConfiguration());
Вышеприведенные приводит к следующей ошибке в myRdd
Bound mismatch: The generic method newAPIHadoopFile(String, Class<F>, Class<K>, Class<V>, Configuration) of type JavaSparkContext is not applicable for the arguments (String, Class<MyInputFormat>, Class<ProtobufWritable>, Class<Text>, Configuration). The inferred type MyInputFormat is not a valid substitute for the bounded parameter <F extends InputFormat<K,V>>
Не уверен, что происходит. Мне кажется, что я удовлетворен границами? Я не могу определить проблему?
This - это код scala, который вызывается.