Spark 2.0, DataFrame, 过滤字符串列,不推荐使用不等号(!==) [英] Spark 2.0, DataFrame, filter a string column, unequal operator (!==) is deprecated

查看:43
本文介绍了Spark 2.0, DataFrame, 过滤字符串列,不推荐使用不等号(!==)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过仅保留具有特定字符串列的那些行非空来过滤 DataFrame.

I am trying to filter a DataFrame by keeping only those rows that have a certain string column non-empty.

操作如下:

df.filter($"stringColumn" !== "")

我的编译器显示 !== 自从我移到 Spark 2.0.1 以来已被弃用

My compiler shows that the !== is deprecated since I moved to Spark 2.0.1

如何在 Spark > 2.0 中检查字符串列值是否为空?

How can I check if a string column value is empty in Spark > 2.0?

推荐答案

使用 =!= 作为替代:

df.filter($"stringColumn" =!= "")

这篇关于Spark 2.0, DataFrame, 过滤字符串列,不推荐使用不等号(!==)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆