I have 2 dataframes df1 and df2. df1 has 1 column key of type String
df1.show() key ---- k1 k2 k3 df2 has 2 columns df2.show() topic | keys ------------- t1 | [k1, k2] t2 | [pk1, pk2]
I want to join the 2 dataframes when df1.key is present in df2.keys. I saw previous examples posted here Spark: Join dataframe column with an array
However, I am looking for a whole word match. Contains method is joining rows that have a partial match. What I mean is in the above example, I don't want k2 to be joined with [pk1, pk2] because array does not contain key k2, it contains pk2.
Can someone suggest how to join in this case ? Please provide example in JAVA.