You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by dong wang <el...@gmail.com> on 2015/04/10 11:02:36 UTC

can we support complex metrics

suppose we have metrics

sum(a)/sum(b)

sum(a): today's new users count
sum(b): previous 7 days(including today)' new users count

in my views, it should belong to query planner component for a standard
olap engine, if we can create temp tables, we can split the query for the
above metrics into multiple sqls, however, it seems that kylin doesn't
support creating temp table to store the intermediate result, thus, can we
support the above complex metrics with kylin now?

Re: can we support complex metrics

Posted by Li Yang <li...@apache.org>.
Let me post this question to calcite community and see what they say.

On Fri, Apr 10, 2015 at 6:04 PM, dong wang <el...@gmail.com> wrote:

> select sum(dau) / (select sum(dau) from test1 where stat_date>'2015-04-02'
> and stat_date<'2015-04-10') from test1 where stat_date='2015-04-09'
>
> or
>
> select sum(dau), (select sum(dau) from test1 where stat_date>'2015-04-02'
> and stat_date<'2015-04-10')  from test1 where stat_date='2015-04-09'
>
> NONE of the above works~
>
>
> 2015-04-10 17:18 GMT+08:00 Luke Han <lu...@gmail.com>:
>
> > Hi Dong,
> >     Could you please try subquery for this?
> >     Thanks.
> > Luke
> >
> >
> > Best Regards!
> > ---------------------
> >
> > Luke Han
> >
> > 2015-04-10 17:02 GMT+08:00 dong wang <el...@gmail.com>:
> >
> > > suppose we have metrics
> > >
> > > sum(a)/sum(b)
> > >
> > > sum(a): today's new users count
> > > sum(b): previous 7 days(including today)' new users count
> > >
> > > in my views, it should belong to query planner component for a standard
> > > olap engine, if we can create temp tables, we can split the query for
> the
> > > above metrics into multiple sqls, however, it seems that kylin doesn't
> > > support creating temp table to store the intermediate result, thus, can
> > we
> > > support the above complex metrics with kylin now?
> > >
> >
>

Re: can we support complex metrics

Posted by dong wang <el...@gmail.com>.
select sum(dau) / (select sum(dau) from test1 where stat_date>'2015-04-02'
and stat_date<'2015-04-10') from test1 where stat_date='2015-04-09'

or

select sum(dau), (select sum(dau) from test1 where stat_date>'2015-04-02'
and stat_date<'2015-04-10')  from test1 where stat_date='2015-04-09'

NONE of the above works~


2015-04-10 17:18 GMT+08:00 Luke Han <lu...@gmail.com>:

> Hi Dong,
>     Could you please try subquery for this?
>     Thanks.
> Luke
>
>
> Best Regards!
> ---------------------
>
> Luke Han
>
> 2015-04-10 17:02 GMT+08:00 dong wang <el...@gmail.com>:
>
> > suppose we have metrics
> >
> > sum(a)/sum(b)
> >
> > sum(a): today's new users count
> > sum(b): previous 7 days(including today)' new users count
> >
> > in my views, it should belong to query planner component for a standard
> > olap engine, if we can create temp tables, we can split the query for the
> > above metrics into multiple sqls, however, it seems that kylin doesn't
> > support creating temp table to store the intermediate result, thus, can
> we
> > support the above complex metrics with kylin now?
> >
>

Re: can we support complex metrics

Posted by Luke Han <lu...@gmail.com>.
Hi Dong,
    Could you please try subquery for this?
    Thanks.
Luke


Best Regards!
---------------------

Luke Han

2015-04-10 17:02 GMT+08:00 dong wang <el...@gmail.com>:

> suppose we have metrics
>
> sum(a)/sum(b)
>
> sum(a): today's new users count
> sum(b): previous 7 days(including today)' new users count
>
> in my views, it should belong to query planner component for a standard
> olap engine, if we can create temp tables, we can split the query for the
> above metrics into multiple sqls, however, it seems that kylin doesn't
> support creating temp table to store the intermediate result, thus, can we
> support the above complex metrics with kylin now?
>