Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 123|"ABC"|hello
- 124|"AB|hello all
- 125|A"B"|hellll
- val myDf = session.sqlContext.read.format("csv")
- .option("charset", "UTF8")
- .option("inferSchema", "true")
- .option("quote","u0000")
- .schema(mySchema)
- .option("delimiter", "|")
- .option("nullValue", "")
- .option("treatEmptyValuesAsNulls", "true")
- .load("path to file")
- myDf.repartition(1).write
- .format("com.databricks.spark.csv")
- .option("delimiter", "|")
- .save("Path to save file")
- 123|""ABC""|hello
- 124|""AB"|hello all
- 125|"A"B""|hellll
- 123|"ABC"|hello
- 124|"AB|hello all
- 125|A"B"|hellll
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement