【发布时间】:2020-05-24 03:49:00
【问题描述】:
我想这个问题的答案可能太明显了。
但我想知道如何获取一个不作为我的 RDD 中任何对的键的值的列表,例如
pairs = [(3,2),(1,3),(1,4)] to [2,4]
keys = pairs.keys().distinct()
现在我想过滤对的值并只返回那些 不在键中,例如:
filteredValues = pairs.values().filter(lambda x: x not in keys)
我得到的错误:
Exception: It appears that you are attempting to broadcast an RDD or reference an RDD from an action or transformation. RDD transformations and actions can only be invoked by the driver, not inside of other transformations; for example, rdd1.map(lambda x: rdd2.values.count() * x) is invalid because the values transformation and count action cannot be performed inside of the rdd1.map transformation. For more information, see SPARK-5063.
所以我清楚地看到问题在于我在对(RDD1)过滤功能中使用键(RDD2)。 问题是,我怎样才能克服这个问题,让我的过滤仍然正确?
感谢您提供建设性帮助。 谢谢。
【问题讨论】: