[jira] [Commented] (KYLIN-3119) A few bugs in the function 'massageSql' of 'QueryUtil.java'

2018-02-25 Thread Roger Shi (JIRA)

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

Roger Shi commented on KYLIN-3119:
--

[~peng.jianhua] Sorry for the late response. As gitbox is online now, do you 
mind sending a github PR? It's supposed to be easier to communicate on code.

> 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
>  Components: Query Engine
>Reporter: peng.jianhua
>Assignee: peng.jianhua
>Priority: Major
> Attachments: 
> 0001-KYLIN-3119-A-few-bugs-in-the-function-massageSql-of-.patch, 
> 0001-KYLIN-3119-add-test-cases.patch, 
> 0001-kylin-3119-add-more-test-cases-with-enter-and-space.patch, 
> 0001-kylin-3119.patch, 01.PNG, 02.PNG
>
>
> 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.
> 02:
> {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 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 1) 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 and 
> 02.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}
> Because KYLIN-2649 is still unresolved,so I didn't change the code,but  it 
> has same 'limit' word bugs like above.
> And there are some situations that the sql contains \*,such as 
> {code:java}count(*),kylin_sales.*{code}
> Maybe the \* in subquery too.
> it seems improperly to deal with the sql just use {code:java}
> sql.toLowerCase().contains("*")
> {code}



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


[jira] [Updated] (KYLIN-3265) Add "jobSearchMode" as a condition to "/kylin/api/jobs" API

2018-02-25 Thread Pan, Julian (JIRA)

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

Pan, Julian updated KYLIN-3265:
---
Attachment: Screen Shot 2018-02-26 at 1.55.21 PM.png

> Add "jobSearchMode" as a condition to "/kylin/api/jobs" API
> ---
>
> Key: KYLIN-3265
> URL: https://issues.apache.org/jira/browse/KYLIN-3265
> Project: Kylin
>  Issue Type: Improvement
>  Components: REST Service
>Affects Versions: v2.3.0
>Reporter: Shaofeng SHI
>Priority: Major
> Attachments: KYLIN-3265.master.002.patch, 
> KYLIN-3265.master.002.patch, KYLIN-3265.master.003.patch, Screen Shot 
> 2018-02-26 at 1.55.21 PM.png
>
>
> In kylin 2.3, the "/kylin/jobs" API will return both cubing job and 
> checkpoint job together, this changed the API's behavior as there isn't 
> checkpoint job before. We should keep the api only return cubing jobs to be 
> compitable as before, and extend the API to add another condition 
> 'jobSearchMode' to determine which kind of job should be returned. 



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


[jira] [Updated] (KYLIN-3265) Add "jobSearchMode" as a condition to "/kylin/api/jobs" API

2018-02-25 Thread Pan, Julian (JIRA)

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

Pan, Julian updated KYLIN-3265:
---
Attachment: KYLIN-3265.master.003.patch

> Add "jobSearchMode" as a condition to "/kylin/api/jobs" API
> ---
>
> Key: KYLIN-3265
> URL: https://issues.apache.org/jira/browse/KYLIN-3265
> Project: Kylin
>  Issue Type: Improvement
>  Components: REST Service
>Affects Versions: v2.3.0
>Reporter: Shaofeng SHI
>Priority: Major
> Attachments: KYLIN-3265.master.002.patch, 
> KYLIN-3265.master.002.patch, KYLIN-3265.master.003.patch, Screen Shot 
> 2018-02-26 at 1.55.21 PM.png
>
>
> In kylin 2.3, the "/kylin/jobs" API will return both cubing job and 
> checkpoint job together, this changed the API's behavior as there isn't 
> checkpoint job before. We should keep the api only return cubing jobs to be 
> compitable as before, and extend the API to add another condition 
> 'jobSearchMode' to determine which kind of job should be returned. 



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


[jira] [Commented] (KYLIN-3265) Add "jobSearchMode" as a condition to "/kylin/api/jobs" API

2018-02-25 Thread Zhong Yanghong (JIRA)

[ 
https://issues.apache.org/jira/browse/KYLIN-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16376327#comment-16376327
 ] 

Zhong Yanghong commented on KYLIN-3265:
---

Hi [~Shaofengshi], patch looks good for me. +1

> Add "jobSearchMode" as a condition to "/kylin/api/jobs" API
> ---
>
> Key: KYLIN-3265
> URL: https://issues.apache.org/jira/browse/KYLIN-3265
> Project: Kylin
>  Issue Type: Improvement
>  Components: REST Service
>Affects Versions: v2.3.0
>Reporter: Shaofeng SHI
>Priority: Major
> Attachments: KYLIN-3265.master.002.patch, KYLIN-3265.master.002.patch
>
>
> In kylin 2.3, the "/kylin/jobs" API will return both cubing job and 
> checkpoint job together, this changed the API's behavior as there isn't 
> checkpoint job before. We should keep the api only return cubing jobs to be 
> compitable as before, and extend the API to add another condition 
> 'jobSearchMode' to determine which kind of job should be returned. 



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