carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #424: [CARBONDATA-528]support octal escape...
Date Tue, 13 Dec 2016 06:16:40 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/424#discussion_r92103661
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java ---
    @@ -599,22 +599,7 @@ public static void writeLevelCardinalityFile(String loadFolderLoc,
String tableN
        * @return
        */
       public static String unescapeChar(String parseStr) {
    -    switch (parseStr) {
    -      case "\\001":
    -        return "\001";
    -      case "\\t":
    -        return "\t";
    -      case "\\r":
    -        return "\r";
    -      case "\\b":
    -        return "\b";
    -      case "\\f":
    -        return "\f";
    -      case "\\n":
    -        return "\n";
    -      default:
    -        return parseStr;
    -    }
    +    return scala.StringContext.treatEscapes(parseStr);
    --- End diff --
    
    I found the functionality of `treatEscapes` is as following. 
    ```
      /** Expands standard Scala escape sequences in a string.
       *  Escape sequences are:
       *   control: `\b`, `\t`, `\n`, `\f`, `\r`
       *   escape:  `\\`, `\"`, `\'`
       *   octal:   `\d` `\dd` `\ddd` where `d` is an octal digit between `0` and `7`.
       *
       *  @param  str  A string that may contain escape sequences
       *  @return The string with all escape sequences expanded.
       */
    ```
    Do you want to support octal string like \1, \2?
    Adding this functionality is good, my concern is that can you find a java function instead
of using scala library? Because generaling speaking, core should not dependent on scala library,
they should be pure java implementation. 
    
    Another thing is can you add a testcase for this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message