spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HyukjinKwon <>
Subject [GitHub] spark pull request #16976: [SPARK-19610][SQL] Support parsing multiline CSV ...
Date Thu, 23 Feb 2017 08:44:45 GMT
Github user HyukjinKwon commented on a diff in the pull request:
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/UnivocityParser.scala
    @@ -233,3 +236,31 @@ private[csv] class UnivocityParser(
    +private[csv] object UnivocityParser {
    +  def tokenizeStream(
    +      inputStream: InputStream,
    +      header: Boolean,
    +      settings: CsvParserSettings): Iterator[Array[String]] = new Iterator[Array[String]]
    +    private val parser = new CsvParser(settings)
    +    // Note that, here we assume `inputStream` is the whole file that might include the
    +    parser.beginParsing(inputStream)
    +    private var nextRecord = {
    +      if (header) {
    +        parser.parseNext()
    --- End diff --
    Yup, existing code path processes line by line so comments and empty lines had to manually
skipped because it threw an error if each line has only commented line or empty. This is nicely
handled in Univocity and the initial version of CSV actually did this in this way.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message