thadeusb commented on a change in pull request #23080: [SPARK-26108][SQL] 
Support custom lineSep in CSV datasource
URL: https://github.com/apache/spark/pull/23080#discussion_r273097269
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVOptions.scala
 ##########
 @@ -192,6 +192,20 @@ class CSVOptions(
    */
   val emptyValueInWrite = emptyValue.getOrElse("\"\"")
 
+  /**
+   * A string between two consecutive JSON records.
+   */
+  val lineSeparator: Option[String] = parameters.get("lineSep").map { sep =>
+    require(sep.nonEmpty, "'lineSep' cannot be an empty string.")
+    require(sep.length == 1, "'lineSep' can contain only 1 character.")
 
 Review comment:
   That is taken care of in this by the following line that I backported no?
   
   `settings.setLineSeparatorDetectionEnabled(lineSeparatorInRead.isEmpty && 
multiLine)`
   
   I am still having the issue that univocity keeps a \r in the column name 
with multiline set to True and lineSeparatorInRead is unset.
   
   The only way I seem to be able to get spark to not put a \r in the column 
name is to specifiy the lineSep option with two characters explicitly to 
`\r\n`. Then I get a normal set of column names and everything else parses 
correctly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to