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/19 06:41:00 UTC

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

     [ https://issues.apache.org/jira/browse/KYLIN-4879?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

wangjie updated KYLIN-4879:
---------------------------
    Description: 
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
{quote}String sql = "select count(*) from test_kylin_fact WHERE column_name ='--this is not comment'\n "+ "LIMIT 100 offset 0";
{quote}
After the removeCommentInSql method, it will become:
{quote}select count(*) from test_kylin_fact WHERE column_name = 'LIMIT 100 offset 0
{quote}
(2) Contain multiple lines of comments in single quotes
{quote}String sql = "select count(*) from test_kylin_fact WHERE column_name ='/**--this *is not comment***/'";
{quote}
After the removeCommentInSql method, it will become:
{quote}select count(*) from test_kylin_fact WHERE column_name =''
{quote}

  was:
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 =''


> 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
>            Priority: Critical
>             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
> {quote}String sql = "select count(*) from test_kylin_fact WHERE column_name ='--this is not comment'\n "+ "LIMIT 100 offset 0";
> {quote}
> After the removeCommentInSql method, it will become:
> {quote}select count(*) from test_kylin_fact WHERE column_name = 'LIMIT 100 offset 0
> {quote}
> (2) Contain multiple lines of comments in single quotes
> {quote}String sql = "select count(*) from test_kylin_fact WHERE column_name ='/**--this *is not comment***/'";
> {quote}
> After the removeCommentInSql method, it will become:
> {quote}select count(*) from test_kylin_fact WHERE column_name =''
> {quote}



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