Scala Spark包含vs.不包含 [英] Scala Spark contains vs. does not contain
本文介绍了Scala Spark包含vs.不包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用包含"过滤RDD中的元组(如下所述).但是,使用不包含"过滤RDD呢?
I can filter - as per below - tuples in an RDD using "contains". But what about filtering an RDD using "does not contain" ?
val rdd2 = rdd1.filter(x => x._1 contains ".")
我找不到此语法.假设有可能并且我没有使用DataFrame
.我看不到如何使用正则表达式和/或过滤器示例.
I cannot find the syntax for this. Assuming it is possible and that I'm not using DataFrame
s. I cannot see from how to do it with regex and/or filter examples.
推荐答案
它只是contains
过滤谓词的否定:
val rdd2 = rdd1.filter(x => !(x._1 contains "."))
这篇关于Scala Spark包含vs.不包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文