How to parse a csv that uses ^A (i.e. \001) as the delimiter with spark-csv?

后端 未结 2 428
盖世英雄少女心
盖世英雄少女心 2020-12-29 08:53

Terribly new to spark and hive and big data and scala and all. I\'m trying to write a simple function that takes an sqlContext, loads a csv file from s3 and returns a DataFr

2条回答
  •  轮回少年
    2020-12-29 09:15

    With Spark 2.x and the CSV API, use the sep option:

    val df = spark.read
      .option("sep", "\u0001")
      .csv("path_to_csv_files")
    

提交回复
热议问题