You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "wangjie (Jira)" <ji...@apache.org> on 2021/01/18 14:25:00 UTC

[jira] [Created] (KYLIN-4879) The function of sql to remove comments is not perfect. In some cases, the sql query conditions used will be modified

wangjie created KYLIN-4879:
------------------------------

             Summary: The function of sql to remove comments is not perfect. In some cases, the sql query conditions used will be modified
                 Key: KYLIN-4879
                 URL: https://issues.apache.org/jira/browse/KYLIN-4879
             Project: Kylin
          Issue Type: Bug
          Components: Query Engine
    Affects Versions: v2.6.0
            Reporter: wangjie
             Fix For: v3.1.0


In the removeCommentInSql method of QueryUtil of the query module, if the single quote character of the user's sql contains -- or /**/, the regular expression will rewrite the sql query condition.

E.g:

(1) When the single quotation mark contains --, line break

String sql = "select count(*) from test_kylin_fact WHERE column_name ='--this is not comment'\n "+ "LIMIT 100 offset 0";

After the removeCommentInSql method, it will become:

select count(*) from test_kylin_fact WHERE column_name = 'LIMIT 100 offset 0

(2) Contain multiple lines of comments in single quotes

String sql = "select count(*) from test_kylin_fact WHERE column_name ='/*--this is not comment*/'";

After the removeCommentInSql method, it will become:

select count(*) from test_kylin_fact WHERE column_name =''



--
This message was sent by Atlassian Jira
(v8.3.4#803005)