我有一个 JavaRDD<Tuple2<String, String>>
,需要将其转换为 JavaPairRDD<String, String>
.目前我通过简单地编写只返回输入元组的映射函数来做到这一点.但是不知道有没有更好的办法?
I have a JavaRDD<Tuple2<String, String>>
and need to transform it to JavaPairRDD<String, String>
. Currently I am doing it by simply writing map function that just returns the input tuple as is. But I wonder if there is a better way?
JavaPairRDD.fromJavaRDD(rdd) 是解决方案之一
JavaPairRDD.fromJavaRDD(rdd) is one of solutions
这篇关于Spark:JavaRDD<Tuple2>到 JavaPairRDD<>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!