Spark 2.0,DataFrame,过滤字符串列,不赞成使用不等于运算符(!==) [英] Spark 2.0, DataFrame, filter a string column, unequal operator (!==) is deprecated

查看:1554
本文介绍了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天全站免登陆