Scala / Spark: getting a subset of columns from a dataframe - How to pass this parameter to .select : I have a way to get a subset of a dataframe which works:

    This works
    val subset_cols = {joinCols :+ col}
    val df1_subset = df1.select(subset_cols.head, subset_cols.tail: _*)


This doesnt work:( The code compiles but I get a run time error)

    val subset_cols = {joinCols :+ col}
    val df1_subset = df1.select(subset_cols.deep.mkString(","))


Error:

    Exception in thread "main" org.apache.spark.sql.AnalysisException: 
    cannot resolve '`first_name,last_name,rank_dr`' given input columns: 
    [model, first_name, service_date, rank_dr, id, purchase_date, 
    dealer_id, purchase_price, age, loyalty_score, vin_num, last_name, color];;

    'Project ['first_name,last_name,rank_dr]
