0
私はCassandra 2.2.8、JDK8、spark-cassandra-connector-java_2.10、spark-cassandra-connector_2.11-2.0.0-M3、cassandra-driver-core-3.1を使用しています。 .0とその後に続く Cassandra Spark Connector Example JavaDemo。このデモは、新しい2.1 Connetcor APIでコンパイルするために修正する必要があります。私はいくつかのことを修正しましたが、1つ下の、これは私に遊説されています。この行で コンパイルエラー:Cassandra Spark Connector JavaDemoコンパイルエラー
JavaPairRDD<Integer, BigDecimal> allSalesRDD = joinedRDD.flatMap(new PairFlatMapFunction<Tuple2<Integer, Tuple2<Sale, Product>>, Integer, BigDecimal>() {
@Override
public Iterable<Tuple2<Integer, BigDecimal>> call(Tuple2<Integer, Tuple2<Sale, Product>> input) throws Exception {
エラー:
The method
flatMap(FlatMapFunction<Tuple2<Integer,Tuple2<SparkJavaDemo.Sale,SparkJavaDemo.Product>>,U>) in the type
AbstractJavaRDDLike<Tuple2<Integer,Tuple2<SparkJavaDemo.Sale,SparkJavaDemo.Product>>,JavaPairRDD<Integer,Tuple2<SparkJavaDemo.
Sale,SparkJavaDemo.Product>>> is not applicable for the arguments (new
PairFlatMapFunction<Tuple2<Integer,Tuple2<SparkJavaDemo.Sale,SparkJavaDemo.Product>>,Integer,BigDecimal>(){})
あなたはflatMapToPair
代わりのflatMap
を使用することができますおかげ
で更新されたコードのための要旨を作成しているこの**取得する別のエラーになりました**: '公共のIterator>コール(Tuple2 <整数、Tuple2 < **戻り値の型は互換性がありません** \t PairFlatMapFunction >、Integer、BigDecimal> .call(Tuple2 >) ' –
コア3.1 Javaドライバを使用すると別のコンパイルエラーが発生する(2.1で問題なく動作する)実装していません \t java.lang.AutoCloseable try(セッションセッション= connector.openSession()) –
JavaDemoのpom.xmlとjavaクラスを更新しました。更新されたファイルはhttps://gist.github.com/baghelamit/f2963d9e37acc55474559104f5f16cf1です。それを確認しましたか? – abaghel