val sparkCfg = new SparkConf().set("spark.driver.maxResultSize", "0")
sparkCfg.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
val sparkSession = SparkSession.builder()
.appName(appCfg.getString("appName"))
.master(appCfg.getString("master"))
.config(sparkCfg).getOrCreate();
val csvDataset = sparkSession.sqlContext.read
.option("header", true).option("multiLine", "true").option("quote", "\"").option("escape", "\"")
.csv(path)
val resultRDD = csvDataset.rdd.map(row=>{
//业务处理
})
resultRDD .saveAsTextFile(srcPath)
val src = new Path(srcPath)
val dst = new Path(srcPath+".out")
val config = new Configuration
FileUtil.copyMerge(src.getFileSystem(config), src, dst.getFileSystem(config), dst, true, config, null)