为了阅读镶木地板文件并将项目存储到缓存中,我做了一个小小的impl。所以我写道:
val df= sqlContext.read.
parquet(hdfsFolder).
select("a","b", "c", "d", "e", "f")
val columnsSeq= Seq("a","b", "c", "d", "e", "f")
val values = df.map(row => (row.getAs[String]("a"), row.getValuesMap(columnsSeq))).
groupByKey(1024).
map(row => (row._1 , row._2.toList.asJava ))
//put them into cache
val igniteContext = new IgniteContext(sc, cacheConfigPath)
val sharedRdd = igniteContext.fromCache(cacheName)
sharedRdd.savePairs(values)
但最后一行“sharedRdd.savePairs(values)”给出了compileerror:
发现:org.apache.spark.rdd.RDD [(String, java.util.List [Map [String,Nothing]])]必需: org.apache.spark.rdd.RDD [(Nothing,Nothing)]注意:( String, java.util.List [Map [String,Nothing]])> :(没什么,没什么),但是类 RDD在类型T中是不变的。您可能希望将T定义为-T。 (SLS 4.5) sharedRdd.savePairs(值)
我找不到任何方法来克服这个错误。
有什么想法吗?
答案 0 :(得分:0)
您应该使用正确的输入创建IgniteRDD
:
val sharedRdd = igniteContext.fromCache[String, java.util.List[Map[String,Nothing]]](cacheName)