You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2021/07/17 07:45:42 UTC

[GitHub] [zeppelin] zjffdu commented on a change in pull request #4179: [ZEPPELIN-5458] fix that zepplin can not parse columns which contains chinese character

zjffdu commented on a change in pull request #4179:
URL: https://github.com/apache/zeppelin/pull/4179#discussion_r671636392



##########
File path: livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java
##########
@@ -197,7 +200,18 @@ public FormType getFormType() {
     return rows;
   }
 
-  protected List<String> parseSQLOutput(String output) {
+  protected List<String> parseSQLOutput(String str) {
+    String fullWidthRegex = "([" +
+            "\u1100-\u115F" +
+            "\u2E80-\uA4CF" +
+            "\uAC00-\uD7A3" +
+            "\uF900-\uFAFF" +
+            "\uFE10-\uFE19" +
+            "\uFE30-\uFE6F" +
+            "\uFF00-\uFF60" +
+            "\uFFE0-\uFFE6" +
+            "])";
+    String output = str.replaceAll(fullWidthRegex, "$1\u0001");

Review comment:
       Use reg expression doesn't seems an elegant approach to me, could you find thrid party library that has such ability ?

##########
File path: livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java
##########
@@ -197,7 +200,18 @@ public FormType getFormType() {
     return rows;
   }
 
-  protected List<String> parseSQLOutput(String output) {
+  protected List<String> parseSQLOutput(String str) {
+    String fullWidthRegex = "([" +
+            "\u1100-\u115F" +
+            "\u2E80-\uA4CF" +
+            "\uAC00-\uD7A3" +
+            "\uF900-\uFAFF" +
+            "\uFE10-\uFE19" +
+            "\uFE30-\uFE6F" +
+            "\uFF00-\uFF60" +
+            "\uFFE0-\uFFE6" +
+            "])";
+    String output = str.replaceAll(fullWidthRegex, "$1\u0001");

Review comment:
       Using regular expression doesn't seems an elegant approach to me, could you find thrid party library that has such ability ?




-- 
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: dev-unsubscribe@zeppelin.apache.org

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