繁体   English   中英

Spark-另一个转换内部的Rdd转换

[英]Spark - Rdd transformation inside another transformation

我试图在另一个转换中转换RDD。 因为,RDD转换和动作只能由驱动程序调用,所以我收集了第二个RDD并尝试将转换应用到其他转换中,如下所示

val name_match = first_names.map(y => (y, first_names_collection.value.filter(z => soundex.difference(z, y) == 4 )   ))

上面的代码抛出以下异常

org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException): Application attempt appattempt_1468905506642_46091_000001 doesn't exist in ApplicationMasterService cache.

在这里,first_names_collection的大小大于10 GB。 那会导致这个问题吗? 还有其他方法吗?

看来您想计算name_match每个元素与first_names_collection每个元素之间的差函数,并找到相差4的对。

通常,对两个RDD执行成对计算是通过先使用cartesian计数所有对来完成的。 您的解决方案如下所示:

first_name.cartesian(first_names_collection)                     // generate all pairs
  .filter{case (lhs, rhs) => soundex.difference(lhs, rhs) == 4}
  .groupByKey                                                    

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM