You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "winifredtang (JIRA)" <ji...@apache.org> on 2018/06/13 07:51:00 UTC

[jira] [Created] (CALCITE-2360) Why doesn't Like.sqlToRegexSimilar(String sqlPattern,char escapeChar) translate "." into "\\."?

winifredtang created CALCITE-2360:
-------------------------------------

             Summary: Why doesn't Like.sqlToRegexSimilar(String sqlPattern,char escapeChar) translate "." into "\\."?
                 Key: CALCITE-2360
                 URL: https://issues.apache.org/jira/browse/CALCITE-2360
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.16.0
            Reporter: winifredtang
            Assignee: Julian Hyde


org.apache.calcite.runtime.SqlFunctions.similar function call Like.sqlToRegexSimilar(String sqlPattern,char escapeChar) to translate SQL SIMILAR pattern to Java regex pattern. "." in SQL SIMILAR pattern is not a metacharacter, but when Like.sqlToRegexSimilar translates it to Java regex pattern, it becomes a metacharacter. 
For example, in SQL SIMILAR pattern, only string "ab." can match the pattern "ab.", but the result of org.apache.calcite.runtime.SqlFunctions.similar("ab1", "ab.") can also ruturn ture.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)