我有10列的CSV文件。Half String和Half是Integers。
什么是Scala代码以:
到目前为止,我有:
import org.apache.spark.sql.SQLContext
val sqlContext = new SQLContext(sc)
val df = sqlContext.read
.format("com.databricks.spark.csv")
.option("header", "true") // Use first line of all files as header
.option("inferSchema", "true") // Automatically infer data types
.load("cars.csv")
Run Code Online (Sandbox Code Playgroud)
保存该模式的最佳文件格式是什么?是JSON吗?
目标是-我只想创建一次架构,下一次从文件中加载,而不是即时重新创建。
谢谢。