You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by jackylk <gi...@git.apache.org> on 2016/12/13 06:16:40 UTC

[GitHub] incubator-carbondata pull request #424: [CARBONDATA-528]support octal escape...

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.
---