【发布时间】:2021-02-13 09:19:46
【问题描述】:
我从 spark 会话创建了一个 RDD。我的数据是系统日志格式。我想将前缀为 1 的行过滤为有效行,将不满足条件的行过滤为无效行。
rdd2=rdd1.filter(lambda rec: rec.startswith('<128>1') or rec.startswith('<134>1'))
如何在同一个函数中获取无效行? 参考:https://sparkbyexamples.com/pyspark/pyspark-where-filter/ spark filter with higher order function
【问题讨论】:
标签: apache-spark pyspark rdd