I have a CSV to write that has that schema :
StructType s = schema.add("codeCommuneCR", StringType, false);
s = s.add("nomCommuneCR", StringType, false);
s = s.add("populationCR", IntegerType, false);
s = s.add("resultatComptable", IntegerType, false);
If I don't provide an option "quoteMode" or even if I set it to NON_NUMERIC, this way :
ds.coalesce(1).write().mode(SaveMode.Overwrite)
.option("header", "true")
.option("quoteMode", "NON_NUMERIC")
.option("quote", "\"")
.csv("./target/out_200071470.csv");
the CSV written by Spark is this one :
codeCommuneCR,nomCommuneCR,populationCR,resultatComptable
03142,LENAX,267,43
If I set an option "quoteAll" instead, like that :
ds.coalesce(1).write().mode(SaveMode.Overwrite)
.option("header", "true")
.option("quoteAll", true)
.option("quote", "\"")
.csv("./target/out_200071470.csv");
it generates :
codeCommuneCR,nomCommuneCR,populationCR,resultatComptable
"03142","LENAX","267","43"
But I would like .option("quoteMode", "NON_NUMERIC") to generate :
codeCommuneCR,nomCommuneCR,populationCR,resultatComptable
"03142","LENAX",267,43
according to my schema.
How should my settings be done ?
Regards,