Sorul
Sorul

Reputation: 354

ERROR: org.apache.spark.sql.AnalysisException: Unable to infer schema for CSV

I try this basic command to read a CSV in scala:

val df = spark.read
  .option("header", "true")
  .option("sep","|")
  .option("inferSchema", "true")
  .csv("path/to/_34File.csv")

And I get:

org.apache.spark.sql.AnalysisException: Unable to infer schema for CSV. It must be specified manually.

What could be the solution?

Upvotes: 2

Views: 2928

Answers (1)

Sorul
Sorul

Reputation: 354

The solution is to rename de file from "_34File.csv" to "34File.csv". It's a peculiar case and that worked for me.

Upvotes: 3

Related Questions