2016-04-12 109 views

回答

1

使用此項目https://github.com/databricks/spark-csv

有來自頭版一個例子:

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")