Load the CSV File, have Spark infer the data types. code example Example: read csv in spark df = spark. read . format("csv") . option("header", "true")