1

I have a dataframe and I'd like to use a filter for a set of values.

I know outside of spark sql I can use something like this.

val SetofUsers = Set("A", "B", "C", "D")
val mydfFiltered = mydf.filter($"user_id" === Some("SetofUsers"))

I am getting an error. I looked at the docs and didn't find an answer. How do I filter for a set of values?

thebluephantom
  • 16,458
  • 8
  • 40
  • 83
Cauder
  • 2,157
  • 4
  • 30
  • 69
  • 4
    Use isin https://stackoverflow.com/questions/32551919/how-to-use-column-isin-with-list. Possible duplicate – C.S.Reddy Gadipally Aug 22 '19 at 14:05
  • Possible duplicate of [How to use Column.isin with list?](https://stackoverflow.com/questions/32551919/how-to-use-column-isin-with-list) – Shaido Aug 23 '19 at 02:11

0 Answers0