I have a spark data frame df. Is there a way of sub selecting a few columns using a list of these columns?
df
scala> df.columns res0: Array[Stri
You can typecast String to spark column like this:
import org.apache.spark.sql.functions._ df.select(cols.map(col): _*)