Github user NathanHowell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16089#discussion_r90521381
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/CSVRelation.scala
 ---
    @@ -245,24 +230,12 @@ private[csv] class CsvOutputWriter(
       override def write(row: Row): Unit = throw new 
UnsupportedOperationException("call writeInternal")
     
       override protected[sql] def writeInternal(row: InternalRow): Unit = {
    -    csvWriter.writeRow(rowToString(row), records == 0L && 
params.headerFlag)
    -    records += 1
    -    if (records % FLUSH_BATCH_SIZE == 0) {
    -      flush()
    -    }
    -  }
    -
    -  private def flush(): Unit = {
    -    val lines = csvWriter.flush()
    -    if (lines.nonEmpty) {
    -      text.set(lines)
    -      recordWriter.write(NullWritable.get(), text)
    -    }
    +    csvWriter.writeRow(rowToString(row), printHeader)
    --- End diff --
    
    The uniVocity CSV writer converts every column to a `String` before writing 
so it's (probably?) not possible to further optimize this without doing a whole 
bunch of work. I only did a quick scan through their code though.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to