我们有两个列表需要过滤第二个列表与使用Spark Scala的第一个列表进行比较

时间:2019-01-31 09:28:35

标签: scala apache-spark

List1 = (" data center best practice design","essentials advantage","technical and business solution")  
List2 = ("data center best","essentials","data","data center","capture","mssp umbrella")

使用Spark-scala的输出:

List_output = ("data center best","essentials","data","data center")

2 个答案:

答案 0 :(得分:1)

您可以使用以下内容。

val list_output = parentList filter (childList.toSet)

答案 1 :(得分:0)

val List_output = List2.filter(p => List1.exists(e => e.matches(s“ $ p。*”)))