Reputation: 891
val data= List("z", "f", "h")
sqlContext.sql("select name from table")
.when($"name".isin(data:_*),1)
.otherwise(0)
.show
How do I do the opposite of isin
? Do we have anything like isnotin
?
Upvotes: 3
Views: 8585
Reputation: 148
What you're looking for is either !
method
!($"name".isin(data:_*))
or not
function:
import org.apache.spark.sql.functions._
not($"name".isin(data:_*))
Upvotes: 13