HyukjinKwon commented on code in PR #37107:
URL: https://github.com/apache/spark/pull/37107#discussion_r915339690
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/csv/CSVOptions.scala:
##########
@@ -215,7 +215,9 @@ class CSVOptions(
*/
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.")
+ require(sep.length <= 2, "'lineSep' can contain only 1 or 2 characters.")
+ if (sep.length == 2) logWarning("It is not recommended to set 'lineSep' " +
+ "with 2 characters due to the limitation of supporting multi-char
'lineSep' within quotes.")
sep
Review Comment:
```suggestion
// Intentionally allow it up to 2 for Window's CRLF although multiple
// characters have an issue with quotes. This is intentionally
undocumented.
require(sep.length <= 2, "'lineSep' can contain only 1 character.")
if (sep.length == 2) logWarning("It is not recommended to set 'lineSep'
" +
"with 2 characters due to the limitation of supporting multi-char
'lineSep' within quotes.")
sep
```
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala:
##########
@@ -2293,7 +2294,41 @@ abstract class CSVSuite
val errMsg2 = intercept[IllegalArgumentException] {
spark.read.option("lineSep", "123").csv(testFile(carsFile)).collect
}.getMessage
- assert(errMsg2.contains("'lineSep' can contain only 1 character"))
+ assert(errMsg2.contains("'lineSep' can contain only 1 or 2 characters."))
Review Comment:
```suggestion
assert(errMsg2.contains("'lineSep' can contain only 1 character"))
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]