scala - How to use DataFrame filter with isin in Spark Java? -
i'm trying filter spark dataframe using list in java.
java.util.list<long> selected = ....; dataframe result = df.filter(df.col("something").isin(????));
the problem isin(...) method accepts scala seq or scala varang.
passing in javaconversions.asscalabuffer(selected) doesn't work either.
any ideas?
you can use this.
df.filter(col("something").isin("valu1","value2")
or
val list = list("value1","value2") df.filter(col("something").isin(list: _*)
in java:
df.filter(col("something").isin(list.stream().toarray(string[]::new))))
Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog.
ReplyDeleteIt is very nicely explained. Your article adds best knowledge to our Java Online Training from India.
or learn thru Java Online Training from India Students.