I have dataframe of 10 columns and want to do function - concatenation based on Array of columns which come as input:
arr = ["col1", "col2", "col3"]
This is current so far:
newDF = rawDF.select(concat(col("col1"), col("col2"), col("col3") )).exceptAll(updateDF.select( concat(col("col1"), col("col2"), col("col3") ) ) )
Also:
df3 = df2.join(df1, concat( df2.col1, df2.col2, df2.col3, df2.col3 ) == df1.col5 )
But I want to make a loop or function to do this based on input array (not hard-coding it as is now).
What is the best way?