I have a CSV file which only has data but doesn't have the column name, now I want to create a dataframe in Spark by using the data of this CSV file and create the schema(column name and datatype) for it. My code as below:
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)
val employee = sqlContext.read.format("com.databricks.spark.csv")
.option("header", "false")
.option("inferSchema", "true")
.load("csv filename")
I want to know what commands I need to add in the code to build the schema in my dataframe?