You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by 华梦真 <hm...@163.com> on 2017/06/30 08:02:58 UTC

I encountered a problem while querying data with kylin's Restful Api

Hi ,
    I used kylin's Restful Api like below:


curl -X POST --user ADMIN:KYLIN  -H "Content-Type:application/json;charset=utf-8" -d '{ "sql":"select sum(a.price),a.PART_DT,a.seller_country,a.seller_id from  KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_country = b.country where a.PART_DT< '2012-08-01'  group by a.PART_DT,a.seller_country,a.seller_id  limit 2 ","project":"test_01" }' http://172.16.71.220:7070/kylin/api/query




Then i got an error like this:
{"url":"http://172.16.71.220:7070/kylin/api/query","exception":"Error while executing SQL \"select sum(a.price),a.PART_DT,a.seller_country,a.seller_id from  KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_country = b.country where a.PART_DT< 2012-08-01  group by a.PART_DT,a.seller_country,a.seller_id  limit 2\": From line 1, column 147 to line 1, column 167: Cannot apply '<' to arguments of type '<DATE> < <INTEGER>'. Supported form(s): '<COMPARABLE_TYPE> < <COMPARABLE_TYPE>'"}




Then i tried to solve the problem:
curl -X POST --user ADMIN:KYLIN  -H "Content-Type:application/json;charset=utf-8" -d '{ "sql":"select sum(a.price),a.PART_DT,a.seller_country,a.seller_id from  KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_country = b.country where a.PART_DT< \'2012-08-01\'  group by a.PART_DT,a.seller_country,a.seller_id  limit 2 ","project":"test_01" }' http://172.16.71.220:7070/kylin/api/query
However,I still failed.There was no response,and the log had nothing about it.


It seemed that  single quotation marks can not be recognized.And I have no idea to solve this problem.


Look forward to your reply.Thanks.




 

Re: I encountered a problem while querying data with kylin's Restful Api

Posted by Li Yang <li...@apache.org>.
The date constants should lead by a 'date' keyword, like date '2012-08-01'.

For example, the above query should rewrite as:
select sum(a.price), a.PART_DT from KYLIN_SALES a where a.PART_DT< *date
'2012-08-01'* group by a.PART_DT

On Fri, Jun 30, 2017 at 4:02 PM, 华梦真 <hm...@163.com> wrote:

> Hi ,
>     I used kylin's Restful Api like below:
>
> curl -X POST --user ADMIN:KYLIN  -H "Content-Type:
> application/json;charset=utf-8" -d '{ "sql":"select sum(a.
> price),a.PART_DT,a.seller_country,a.seller_id from
> KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_
> country = b.country where a.PART_DT< '2012-08-01'  group
> by a.PART_DT,a.seller_country,a.seller_id  limit 2 ","
> project":"test_01" }' http://172.16.71.220:7070/kylin/api/query
>
>
> Then i got an error like this:
> {"url":"http://172.16.71.220:7070/kylin/api/query","
> exception":"Error while executing SQL \"select sum(a.
> price),a.PART_DT,a.seller_country,a.seller_id from
> KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_
> country = b.country where a.PART_DT< 2012-08-01  group by
> a.PART_DT,a.seller_country,a.seller_id  limit 2\": From
> line 1, column 147 to line 1, column 167: Cannot apply '<'
> to arguments of type '<DATE> < <INTEGER>'. Supported form(s)
> : '<COMPARABLE_TYPE> < <COMPARABLE_TYPE>'"}
>
>
> Then i tried to solve the problem:
> curl -X POST --user ADMIN:KYLIN  -H "Content-Type:
> application/json;charset=utf-8" -d '{ "sql":"select sum(a.
> price),a.PART_DT,a.seller_country,a.seller_id from
> KYLIN_SALES  a inner join KYLIN_COUNTRY  b on a.seller_
> country = b.country where a.PART_DT< \'2012-08-01\'  group by a.
> PART_DT,a.seller_country,a.seller_id  limit 2 ","project":"test_01" }'
> http://172.16.71.220:7070/kylin/api/query
> However,I still failed.There was no response,and the log had nothing about
> it.
>
> It seemed that  single quotation marks can not be recognized.And I have no
> idea to solve this problem.
>
> Look forward to your reply.Thanks.
>
>
>
>
>
>
>