afedulov commented on code in PR #24730:
URL: https://github.com/apache/flink/pull/24730#discussion_r1611060409


##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvBulkWriter.java:
##########
@@ -98,16 +108,17 @@ static <T> CsvBulkWriter<T, T, Void> forPojo(Class<T> 
pojoClass, FSDataOutputStr
     @Override
     public void addElement(T element) throws IOException {
         final R r = converter.convert(element, converterContext);
-        csvWriter.writeValue(stream, r);
+        csvWriter.writeValue(generator, r);
     }
 
     @Override
     public void flush() throws IOException {
-        stream.flush();
+        generator.flush();
     }
 
     @Override
     public void finish() throws IOException {
+        generator.close();

Review Comment:
   @GOODBOY008 properly testing this behavior with a unit test might be tricky. 
I wrote a quick sketch of an integration test that you could consider making 
use of:
   
https://github.com/afedulov/flink/blob/fix-csv-flush-test/flink-formats/flink-csv/src/test/java/org/apache/flink/formats/csv/CsvBulkWriterTest.java
   I did not spend much time coming up with proper assertions, you can surely 
come up with something more elegant.



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

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to