3

I am trying to do a filter with wildcard, example: df.filter($"dst_ip"==="1.1.1.*"). Somehow, when I do df.show(), it returns blank. Is there an alternative on how to do wildcard filter on a dataframe?

MaxU - stand with Ukraine
  • 205,989
  • 36
  • 386
  • 419
user1342124
  • 601
  • 1
  • 7
  • 15

1 Answers1

3

Why don't you use a contains:

df.filter($"dst_ip".contains("1.1.1."))

Or if you want the string at the beginning, you can use the like just as in SQL:

df.filter($"dst_ip".like("1.1.1.%"))
SCouto
  • 7,808
  • 5
  • 32
  • 49