Spark 2.0, DataFrame, filter a string column, unequal operator (!==) is deprecated

。_饼干妹妹 提交于 2019-12-05 14:38:14

问题


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

The operation is the following:

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

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

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


回答1:


Use =!= as a replacement:

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


来源:https://stackoverflow.com/questions/40154104/spark-2-0-dataframe-filter-a-string-column-unequal-operator-is-deprecat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!