pnowojski commented on a change in pull request #8621:
[FLINK-12682][connectors] StringWriter support custom row delimiter
URL: https://github.com/apache/flink/pull/8621#discussion_r300620094
##########
File path:
flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/StringWriter.java
##########
@@ -40,12 +40,18 @@
private transient Charset charset;
+ private String rowDelimiter;
+
+ private static final String DEFAULT_ROW_DELIMITER = "\n";
+
+ private byte[] rowDelimiterBytes;
+
/**
* Creates a new {@code StringWriter} that uses {@code "UTF-8"} charset
to convert
* strings to bytes.
*/
public StringWriter() {
- this("UTF-8");
+ this("UTF-8", "\n");
Review comment:
Yes, as I wrote in another comment, I missed that `rowDelimiterBytes`
depends on the `charset` which is initialised only in `open`.
Normally I would change `charset` to `private final transient` field, but
this might require adding `throws IOException` clause to the constructor and
would change the current contract a little bit which is a separate independent
issue. In that case, I would give +1 for keeping `rowDelimiterBytes` field
non-final as you have initially proposed.
----------------------------------------------------------------
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