spark APIを使用してHbaseデータを読み取ろうとしています。JavaでnewAPIHadoopRDD(spark)を使用してHbaseデータを読み取る方法
コード:
// Define SparkContext
SparkConf sparkConf = new SparkConf().setAppName("Spark-Hbase").setMaster("master");
sparkConf.set("XXX", "XXX");
JavaSparkContext jsc = new JavaSparkContext(sparkConf);
// Conf with Hbase
Configuration conf = HBaseConfiguration.create();
// Read data using spark
JavaPairRDD<ImmutableBytesWritable, Result> hBaseRDD =
jsc.newAPIHadoopRDD(conf, TableInputFormat.class, ImmutableBytesWritable.class, Result.class);
問題がnewAPIHadoopRDD方法です。私はこのエラーがあり、私は理解していません。
Bound mismatch: The generic method newAPIHadoopRDD(Configuration, Class<F>, Class<K>, Class<V>) of type JavaSparkContext is not applicable for the arguments (Configuration, Class<TableInputFormat>, Class<ImmutableBytesWritable>, Class<Result>). The inferred type TableInputFormat is not a valid substitute for the bounded parameter <F extends InputFormat<K,V>>
修正方法録音は、どのようなタイプのものであろう
は、そのクラス 'TableInputFormatを確認し、以下の例に従うことができます'、' ImmutableBytesWritable'と 'Result'には正しいimport文があります – AdamSkywalker