You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/04/17 09:56:01 UTC

[GitHub] [flink] fhueske commented on a change in pull request #8030: [FLINK-11991] Set headers to use for CSV output

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:
users@infra.apache.org


With regards,
Apache Git Services