kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "peng.jianhua (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (KYLIN-3119) Fix a few bugs in the function 'massageSql' of 'QueryUtil.java'
Date Wed, 20 Dec 2017 08:20:00 GMT

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

peng.jianhua updated KYLIN-3119:
--------------------------------
    Description: 
in the function 'massageSql' of 'QueryUtil.java',there are a few bugs:
01:
{code:java}
        while (sql.endsWith(";"))
            sql = sql.substring(0, sql.length() - 1);
{code}
if the sql end with ';' and after the ';' still has comments,will be error.Because the sql
will add ("\nLIMIT " + limit) at the end.

{code:java}
        if (limit > 0 && !sql.toLowerCase().contains("limit")) {
            sql += ("\nLIMIT " + limit);
        }

        if (offset > 0 && !sql.toLowerCase().contains("offset")) {
            sql += ("\nOFFSET " + offset);
        }
{code}
if the sql end with ';' and after the ';' still has comments,will be error.

02:
if the sql already has word 'limit' in it,such as Alias,Subquery,Comments,the ‘limit’
in the Input box will be invalid.
for example,the sql has subquery,and there is 'limit' in subquery.

{code:java}
select KYLIN_SALES.PART_DT, count(KYLIN_SALES.PRICE)
from KYLIN_SALES
inner join (select ACCOUNT_ID, ACCOUNT_BUYER_LEVEL from KYLIN_ACCOUNT where ACCOUNT_COUNTRY
= 'US' limit 10000) as TT
on KYLIN_SALES.BUYER_ID = TT.ACCOUNT_ID
group by KYLIN_SALES.PART_DT
{code}
the ‘limit’ in the Input box will be invalid.please refer to 01.png.
03:
{code:java}
        // https://issues.apache.org/jira/browse/KYLIN-2649
        if (kylinConfig.getForceLimit() > 0 && !sql.toLowerCase().contains("limit")
                && sql.toLowerCase().contains("*")) {
            sql += ("\nLIMIT " + kylinConfig.getForceLimit());
        }
{code}



  was:
in the function 'massageSql' of 'QueryUtil.java'
{code:java}
        while (sql.endsWith(";"))
            sql = sql.substring(0, sql.length() - 1);
{code}
if the sql end with ';' and after the ';' still has comments,will be error.Because the sql
will add ("\nLIMIT " + limit) at the end.

{code:java}
        if (limit > 0 && !sql.toLowerCase().contains("limit")) {
            sql += ("\nLIMIT " + limit);
        }

        if (offset > 0 && !sql.toLowerCase().contains("offset")) {
            sql += ("\nOFFSET " + offset);
        }
{code}
if the sql end with ';' and after the ';' still has comments,will be error.

if the sql already has word 'limit' in it,such as Alias,Subquery,Comments,the ‘limit’
in the Input box will be invalid.
for example,the sql has subquery,and there is 'limit' in subquery.

{code:java}
select KYLIN_SALES.PART_DT, count(KYLIN_SALES.PRICE)
from KYLIN_SALES
inner join (select ACCOUNT_ID, ACCOUNT_BUYER_LEVEL from KYLIN_ACCOUNT where ACCOUNT_COUNTRY
= 'US' limit 10000) as TT
on KYLIN_SALES.BUYER_ID = TT.ACCOUNT_ID
group by KYLIN_SALES.PART_DT
{code}
the ‘limit’ in the Input box will be invalid.please refer to 01.png.

{code:java}
        // https://issues.apache.org/jira/browse/KYLIN-2649
        if (kylinConfig.getForceLimit() > 0 && !sql.toLowerCase().contains("limit")
                && sql.toLowerCase().contains("*")) {
            sql += ("\nLIMIT " + kylinConfig.getForceLimit());
        }
{code}




> Fix a few bugs in the function 'massageSql' of 'QueryUtil.java'
> ---------------------------------------------------------------
>
>                 Key: KYLIN-3119
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3119
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: peng.jianhua
>            Assignee: peng.jianhua
>
> in the function 'massageSql' of 'QueryUtil.java',there are a few bugs:
> 01:
> {code:java}
>         while (sql.endsWith(";"))
>             sql = sql.substring(0, sql.length() - 1);
> {code}
> if the sql end with ';' and after the ';' still has comments,will be error.Because the
sql will add ("\nLIMIT " + limit) at the end.
> {code:java}
>         if (limit > 0 && !sql.toLowerCase().contains("limit")) {
>             sql += ("\nLIMIT " + limit);
>         }
>         if (offset > 0 && !sql.toLowerCase().contains("offset")) {
>             sql += ("\nOFFSET " + offset);
>         }
> {code}
> if the sql end with ';' and after the ';' still has comments,will be error.
> 02:
> if the sql already has word 'limit' in it,such as Alias,Subquery,Comments,the ‘limit’
in the Input box will be invalid.
> for example,the sql has subquery,and there is 'limit' in subquery.
> {code:java}
> select KYLIN_SALES.PART_DT, count(KYLIN_SALES.PRICE)
> from KYLIN_SALES
> inner join (select ACCOUNT_ID, ACCOUNT_BUYER_LEVEL from KYLIN_ACCOUNT where ACCOUNT_COUNTRY
= 'US' limit 10000) as TT
> on KYLIN_SALES.BUYER_ID = TT.ACCOUNT_ID
> group by KYLIN_SALES.PART_DT
> {code}
> the ‘limit’ in the Input box will be invalid.please refer to 01.png.
> 03:
> {code:java}
>         // https://issues.apache.org/jira/browse/KYLIN-2649
>         if (kylinConfig.getForceLimit() > 0 && !sql.toLowerCase().contains("limit")
>                 && sql.toLowerCase().contains("*")) {
>             sql += ("\nLIMIT " + kylinConfig.getForceLimit());
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message