fhueske commented on a change in pull request #8030: [FLINK-11991] Set headers 
to use for CSV output
URL: https://github.com/apache/flink/pull/8030#discussion_r276161491
 
 

 ##########
 File path: 
flink-java/src/main/java/org/apache/flink/api/java/io/CsvOutputFormat.java
 ##########
 @@ -161,6 +173,29 @@ public void open(int taskNumber, int numTasks) throws 
IOException {
                super.open(taskNumber, numTasks);
                this.wrt = this.charsetName == null ? new 
OutputStreamWriter(new BufferedOutputStream(this.stream, 4096)) :
                                new OutputStreamWriter(new 
BufferedOutputStream(this.stream, 4096), this.charsetName);
+               // print headers
+               if (this.headers != null) {
+                       for (int i = 0; i < headers.length; i++) {
+                               String v = headers[i];
+                               if (v != null) {
+                                       if (i != 0) {
+                                               
this.wrt.write(this.fieldDelimiter);
 
 Review comment:
   Construct the header row in a `StringBuilder` and print it all at once?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to