wangyang0918 commented on a change in pull request #11070: [FLINK-16013][core]
Make complex type config options could be parsed correctly
URL: https://github.com/apache/flink/pull/11070#discussion_r383150314
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/StructuredOptionsSplitter.java
##########
@@ -52,6 +59,37 @@
return processTokens(tokens);
}
+ /**
+ * When write a string out, it is always needs to escaped. If the input
string contains double quote or specified
+ * escape chars, then it will be escaped by single quote. The single
quote will be escaped by doubling.
+ *
+ * <p>Given that the escapeChar is (;)
+ *
+ * <p>Examples:
+ * <ul>
+ * <li>A,B,C,D => A,B,C,D</li>
+ * <li>A;BCD => 'A;BCD'</li>
+ * <li>AB"C"D => 'AB"C"D'</li>
+ * <li>AB'"D:B => 'AB''"D:B'</li>
+ * </ul>
+ *
+ * @param value a string which needs to be escaped
+ * @param escapeChars escape chars for the escape conditions
+ * @return escaped string with single quote
+ */
+ static String escapeWithSingleQuote(String value, String...
escapeChars) {
Review comment:
Usually the guava implementation has better performance than java regex
replacement. However, i am not against with removing the guava dependencies. I
will use `"'" + value.replaceAll("'", "''") + "'"` instead.
----------------------------------------------------------------
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