Kondakov Artem created KYLIN-5171:
-------------------------------------

             Summary: SQL parse error when cast to varchar
                 Key: KYLIN-5171
                 URL: https://issues.apache.org/jira/browse/KYLIN-5171
             Project: Kylin
          Issue Type: Bug
          Components: Query Engine
    Affects Versions: v4.0.1
         Environment: 
https://hub.docker.com/r/apachekylin/apache-kylin-standalone
            Reporter: Kondakov Artem
             Fix For: v4.0.2


good afternoon.
I deployed a standard apache/kylin 4.0.1 docker container
Build the kylin_sales_cube cube from sample project.
Then i tried to run the following query
{code:java}
// 
select  
    cast(MINUTE(KS.PART_DT) as varchar) as PART_DT2,         
    count(KS.LSTG_FORMAT_NAME) as "LSTG_FORMAT_NAME" 
from KYLIN4.KYLIN_SALES as KS 
    join KYLIN4.KYLIN_ACCOUNT as SELLER_ACCOUNT on SELLER_ACCOUNT.ACCOUNT_ID = 
KS.SELLER_ID 
    where  (SELLER_ACCOUNT.ACCOUNT_BUYER_LEVEL = 2)  
    group by PART_DT2 order by PART_DT2 {code}
it gives me an error
{code:java}
DataType varchar is not supported.(line 22, pos 35) 

{code}
 

If I run the following query then all is well

 
{code:java}
select 
    MINUTE(KS.PART_DT) as PART_DT2,
    count(KS.LSTG_FORMAT_NAME) as "LSTG_FORMAT_NAME"
from KYLIN4.KYLIN_SALES as KS
join KYLIN4.KYLIN_ACCOUNT as SELLER_ACCOUNT on SELLER_ACCOUNT.ACCOUNT_ID = 
KS.SELLER_ID
where (SELLER_ACCOUNT.ACCOUNT_BUYER_LEVEL = 2)
group by PART_DT2 order by PART_DT2  {code}
its ok.

 

and next query are good to.

 
{code:java}
select 
cast(MINUTE(KS.PART_DT) as varchar) as PART_DT2,
    count(KS.LSTG_FORMAT_NAME) as "LSTG_FORMAT_NAME"
from KYLIN4.KYLIN_SALES as KS
join KYLIN4.KYLIN_ACCOUNT as SELLER_ACCOUNT on SELLER_ACCOUNT.ACCOUNT_ID = 
KS.SELLER_ID
group by PART_DT2 order by PART_DT2  {code}
 

 

What could be the problem. And please, tell me if there is an example of the 
correct grouping of data by the date field with intervals (by minutes, by 
hours, by days, by weeks, by quarters, by years, etc.)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to