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 2021/10/09 09:59:07 UTC

[GitHub] [flink] hililiwei commented on a change in pull request #17416: [FLINK-24459] Performance improvement of file sink

hililiwei commented on a change in pull request #17416:
URL: https://github.com/apache/flink/pull/17416#discussion_r725465714



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PartitionPathUtils.java
##########
@@ -113,19 +113,36 @@ private static String escapePathName(String path) {
             throw new TableException("Path should not be null or empty: " + path);
         }
 
-        StringBuilder sb = new StringBuilder();
+        StringBuilder sb = null;
         for (int i = 0; i < path.length(); i++) {
             char c = path.charAt(i);
             if (needsEscaping(c)) {
-                sb.append('%');
-                sb.append(String.format("%1$02X", (int) c));
-            } else {
+                if (sb == null) {
+                    sb = new StringBuilder(path.length() + 2);
+                    for (int j = 0; j < i; j++) {
+                        sb.append(path.charAt(j));
+                    }
+                }
+                escapeChar(c, sb);
+            } else if (sb != null) {
                 sb.append(c);
             }
         }

Review comment:
       Will an incorrect result be returned if the character need to be escaped is in the middle?




-- 
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-unsubscribe@flink.apache.org

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