Unmesha SreeVeni shares how to get a specific set of columns by name from a DataFrame in Spark:
Create a List[Column] with column names.
scala> var selectExpr : List[Column] = List("Type","Item","Price")
<console>:25: error: not found: type Column var selectExpr : List[Column] = List("Type","Item","Price") ^
If you are getting the same error Please take a look into this page .
Read on for the demo.