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)))) 

Comments

  1. 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.
    It 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.

    ReplyDelete

Post a Comment

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -