For your case, I think you can use a trick for separating with “ “,” " instead
of “,”
You can refer the following code snippet
val people = sc.textFile("examples/src/main/resources/data.csv").map( x =>
x.substring(1,x.length-1).split("\",\"")).map(p => List(p(0), p(1), p(2)))
On Feb 19, 2015,
Hi Yanbo,
unfortunately all csv files contain comma inside some columns and I can't
change the structure.
How can I work with this kind of textfile and spark-sql?
Thank you again
2015-02-19 14:38 GMT+01:00 Yanbo Liang :
> This is because of each line will be separated into 4 columns instead of
This is because of each line will be separated into 4 columns instead of 3
columns.
If you want to use comma to separate different columns, each column will be
not allowed to include commas.
2015-02-19 18:12 GMT+08:00 sparkino :
> Hello everybody,
> I'm quite new to Spark and Scala as well and I