spark.read
.format("org.apache.spark.sql.execution.datasources.csv.CSVFileFormat")
.format("csv")
.option("header", "true") // Use first line of all files as header
.option("inferSchema", "false") // Automatically infer data types
.option("delimiter", ",")
.load(csvPath)
报错内容:

Multiple sources found for csv (org.apache.spark.sql.execution.datasources.csv.CSVFileFormat, com.databricks.spark.csv.DefaultSource15), please specify the fully qualified class name
解决方法:Spark 2.0后需要加入csv的完全路径:
spark
.read
.format("org.apache.spark.sql.execution.datasources.csv.CSVFileFormat")
.option("header","true")
.schema(schema)
.load(csvPath)
本文介绍了如何使用Spark正确地加载CSV文件,特别是针对Spark 2.0及更高版本中出现的多个源问题,并提供了解决方案。
1440

被折叠的 条评论
为什么被折叠?



