Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-34768][SQL] Respect the default input buffer size in Univocity #31858

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ class CSVOptions(

val quoteAll = getBool("quoteAll", false)

val inputBufferSize = 128

/**
* The max error content length in CSV parser/writer exception message.
*/
Expand Down Expand Up @@ -259,7 +257,6 @@ class CSVOptions(
settings.setIgnoreLeadingWhitespaces(ignoreLeadingWhiteSpaceInRead)
settings.setIgnoreTrailingWhitespaces(ignoreTrailingWhiteSpaceInRead)
settings.setReadInputOnSeparateThread(false)
settings.setInputBufferSize(inputBufferSize)
settings.setMaxColumns(maxColumns)
settings.setNullValue(nullValue)
settings.setEmptyValue(emptyValueInRead)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,27 @@ abstract class CSVSuite
assert(result.sameElements(exceptResults))
}
}

test("SPARK-34768: counting a long record with ignoreTrailingWhiteSpace set to true") {
val line = "XX |XXX-XXXX |XXXXXX " +
"|XXXXXXXX|XXXXX |XXXXXX " +
"|X|XXXXXXX|XXXXXXXX|XXXX|XXXXXXXXXXXXXXX |XXXXXXXXXXX" +
"|XXXXXX |XXXXXXXXXXXXXXXXXXXXXX|XXXXXX " +
"|XXXXXXXXXXXXXX|XXXXXX |XXXXXXXXXXXXXXXXXXXXXX" +
"|XXXXXX |XXXXXXXXXXXXXXXXXXXXXX|XXXXXX " +
"|XXXXXXXXX|XXXXXX |XXXXXXX| " +
"|| || " +
"|| ||XXXX-XX-XX XX:XX:XX.XXXXXXX" +
"||XXXXX.XXXXXXXXXXXXXXX|XXXXX.XXXXXXXXXXXXXX" +
"|XXXXX.XXXXXXXXXXXXXXX|X|XXXXXX |X"
withTempPath { path =>
Seq(line).toDF.write.text(path.getAbsolutePath)
assert(spark.read.format("csv")
.option("delimiter", "|")
.option("inferSchema", "true")
.option("ignoreTrailingWhiteSpace", "true").load(path.getAbsolutePath).count() == 1)
}
}
}

class CSVv1Suite extends CSVSuite {
Expand Down