You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by shuaishuai <39...@qq.com> on 2017/04/01 04:14:06 UTC

How can i use the sql function by kylin version 1.6

i have a fact table named "A"  with 4 cloumns          clicks     cost        
dates                 product  1       1       1.00        2016-01-02          
A  2       2       3.00        2016-01-03           B  3       5       16.00     
2016-01-03           A  4       3       6.00        2016-01-04           A 
there have an error when use the sql like "select sum(clicks)/sum(cost) from
xxxx group xxxx "  and how can i  group by "year" and "month" with cloumn
"dates" ?

--
View this message in context: http://apache-kylin.74782.x6.nabble.com/How-can-i-use-the-sql-function-by-kylin-version-1-6-tp7566.html
Sent from the Apache Kylin mailing list archive at Nabble.com.

Re: How can i use the sql function by kylin version 1.6

Posted by ShaoFeng Shi <sh...@apache.org>.
You can use a lookup table for calendar dates, like the "KYLIN_CAL_DT"
table in sample cube.

2017-04-04 17:13 GMT+08:00 Li Yang <li...@apache.org>:

> Please provide detailed error messages or logs, or no one can help you.
>
> > how can i  group by "year" and "month" with cloumn "dates" ?
> There are SQL functions like:
> - EXTRACT(MONTH FROM "TEST_CAL_DT"."WEEK_BEG_DT")
> - EXTRACT(YEAR FROM "TEST_CAL_DT"."WEEK_BEG_DT")
>
>
> On Sat, Apr 1, 2017 at 12:14 PM, shuaishuai <39...@qq.com> wrote:
>
> > i have a fact table named "A"  with 4 cloumns          clicks     cost
> > dates                 product  1       1       1.00        2016-01-02
> > A  2       2       3.00        2016-01-03           B  3       5
> >  16.00
> > 2016-01-03           A  4       3       6.00        2016-01-04
>  A
> > there have an error when use the sql like "select sum(clicks)/sum(cost)
> > from
> > xxxx group xxxx "  and how can i  group by "year" and "month" with cloumn
> > "dates" ?
> >
> > --
> > View this message in context: http://apache-kylin.74782.x6.
> > nabble.com/How-can-i-use-the-sql-function-by-kylin-version-
> 1-6-tp7566.html
> > Sent from the Apache Kylin mailing list archive at Nabble.com.
> >
>



-- 
Best regards,

Shaofeng Shi 史少锋

Re: How can i use the sql function by kylin version 1.6

Posted by Li Yang <li...@apache.org>.
Please provide detailed error messages or logs, or no one can help you.

> how can i  group by "year" and "month" with cloumn "dates" ?
There are SQL functions like:
- EXTRACT(MONTH FROM "TEST_CAL_DT"."WEEK_BEG_DT")
- EXTRACT(YEAR FROM "TEST_CAL_DT"."WEEK_BEG_DT")


On Sat, Apr 1, 2017 at 12:14 PM, shuaishuai <39...@qq.com> wrote:

> i have a fact table named "A"  with 4 cloumns          clicks     cost
> dates                 product  1       1       1.00        2016-01-02
> A  2       2       3.00        2016-01-03           B  3       5
>  16.00
> 2016-01-03           A  4       3       6.00        2016-01-04           A
> there have an error when use the sql like "select sum(clicks)/sum(cost)
> from
> xxxx group xxxx "  and how can i  group by "year" and "month" with cloumn
> "dates" ?
>
> --
> View this message in context: http://apache-kylin.74782.x6.
> nabble.com/How-can-i-use-the-sql-function-by-kylin-version-1-6-tp7566.html
> Sent from the Apache Kylin mailing list archive at Nabble.com.
>