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

    https://github.com/apache/spark/pull/16089#discussion_r90380594
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala
 ---
    @@ -132,39 +128,17 @@ class TextOutputWriter(
         context: TaskAttemptContext)
       extends OutputWriter {
     
    -  private[this] val buffer = new Text()
    -
    -  private val recordWriter: RecordWriter[NullWritable, Text] = {
    -    new TextOutputFormat[NullWritable, Text]() {
    -      override def getDefaultWorkFile(context: TaskAttemptContext, 
extension: String): Path = {
    -        new Path(path)
    -      }
    -    }.getRecordWriter(context)
    -  }
    +  private val writer = CodecStreams.getOutputStream(context, new 
Path(path))
     
       override def write(row: Row): Unit = throw new 
UnsupportedOperationException("call writeInternal")
     
       override protected[sql] def writeInternal(row: InternalRow): Unit = {
         val utf8string = row.getUTF8String(0)
    -    buffer.set(utf8string.getBytes)
    -    recordWriter.write(NullWritable.get(), buffer)
    +    writer.write(utf8string.getBytes)
    +    writer.write('\n')
    --- End diff --
    
    This mirrors what Hadoop code does, see 
https://github.com/apache/hadoop/blob/f67237cbe7bc48a1b9088e990800b37529f1db2a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/output/TextOutputFormat.java#L48-L49


---
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