scala - Filter Spark DataFrame by checking if value is in a list, with other criteria

ID : 131380

viewed : 7

Tags : scalaapache-sparkapache-spark-sqlscala

Top 3 Answer for scala - Filter Spark DataFrame by checking if value is in a list, with other criteria

vote vote

93

val list = List("x","y","t")  xdf.filter($"column".isin(list: _*)) 
vote vote

90

You have to parenthesize individual expressions:

xdf.filter(($"cnt" > 1) || ($"name" isin ("A","B"))).show() 
vote vote

78

Top 3 video Explaining scala - Filter Spark DataFrame by checking if value is in a list, with other criteria

Related QUESTION?