You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by Li Yang <li...@apache.org> on 2017/09/03 11:12:50 UTC
Re: count_distinct_if, count_if and sum_if
Kylin does not support FILTER clause as of 2.1
On Wed, Aug 30, 2017 at 3:06 PM, Julian Hyde <jh...@gmail.com> wrote:
> Are you aware of the FILTER clause? I believe that COUNT_DISTINCT_IF(x, b)
> is equivalent to COUNT(DISTINCT x) FILTER(WHERE b). And similarly COUNT_IF
> and SUM_IF.
>
> FILTER has been in Calcite for a while; I don't know whether it has made
> it into Kylin yet.
>
> Julian
>
> > On Aug 28, 2017, at 8:26 AM, Alexander Sterligov <st...@joom.it>
> wrote:
> >
> > Hi!
> >
> > I would like to add _if functions to kylin. Could you please help me.
> >
> > I already succeeded with count_distinct_if. It was quite easy because
> > intersect_count is very close to count_distinct_if, I only needed to make
> > 'factories' and 'udafMap' in MeasureTypeFactory to be multimaps.
> >
> > But I have problems with count_if, because BasicMeasureType doesn't have
> > any rewrite functions and implemented in a different way from other
> measure
> > types. There are already some dirty code to handle BasicMeasureType
> > functions and it looks like new hacks for count_if is not a good idea.
> It's
> > better to refactor it to be same for all types and implement count, sum,
> > min, max as rewrite functions. Am I right?
> >
> >
> > ---------- Forwarded message ----------
> > From: Billy Liu <bi...@apache.org>
> > Date: Mon, Aug 28, 2017 at 5:20 PM
> > Subject: Re: count_distinct_if, count_if and sum_if
> > To: user <us...@kylin.apache.org>
> >
> >
> > This kinds of contribution is very welcomed. Could you send your issue to
> > dev mailer, the community will help you.
> >
> > 2017-08-28 21:40 GMT+08:00 Alexander Sterligov <st...@joom.it>:
> >
> >> Hi!
> >>
> >> It would be nice to have if-functions in kylin. What do you think?
> >>
> >> I've already implemented count_distinct_if, but I have problems adding
> new
> >> functions for BasicMeasureType.
> >>
> >> Best regards,
> >> Alexander Sterligov
> >>
>
Re: count_distinct_if, count_if and sum_if
Posted by Li Yang <li...@apache.org>.
@Alex, support of the FILTER clause or the count_distinct_if() will be more
complicated than you think. It is not just about measure type.
You can open a JIRA and collaborate there.
On Sun, Sep 3, 2017 at 7:12 PM, Li Yang <li...@apache.org> wrote:
> Kylin does not support FILTER clause as of 2.1
>
> On Wed, Aug 30, 2017 at 3:06 PM, Julian Hyde <jh...@gmail.com>
> wrote:
>
>> Are you aware of the FILTER clause? I believe that COUNT_DISTINCT_IF(x,
>> b) is equivalent to COUNT(DISTINCT x) FILTER(WHERE b). And similarly
>> COUNT_IF and SUM_IF.
>>
>> FILTER has been in Calcite for a while; I don't know whether it has made
>> it into Kylin yet.
>>
>> Julian
>>
>> > On Aug 28, 2017, at 8:26 AM, Alexander Sterligov <st...@joom.it>
>> wrote:
>> >
>> > Hi!
>> >
>> > I would like to add _if functions to kylin. Could you please help me.
>> >
>> > I already succeeded with count_distinct_if. It was quite easy because
>> > intersect_count is very close to count_distinct_if, I only needed to
>> make
>> > 'factories' and 'udafMap' in MeasureTypeFactory to be multimaps.
>> >
>> > But I have problems with count_if, because BasicMeasureType doesn't have
>> > any rewrite functions and implemented in a different way from other
>> measure
>> > types. There are already some dirty code to handle BasicMeasureType
>> > functions and it looks like new hacks for count_if is not a good idea.
>> It's
>> > better to refactor it to be same for all types and implement count, sum,
>> > min, max as rewrite functions. Am I right?
>> >
>> >
>> > ---------- Forwarded message ----------
>> > From: Billy Liu <bi...@apache.org>
>> > Date: Mon, Aug 28, 2017 at 5:20 PM
>> > Subject: Re: count_distinct_if, count_if and sum_if
>> > To: user <us...@kylin.apache.org>
>> >
>> >
>> > This kinds of contribution is very welcomed. Could you send your issue
>> to
>> > dev mailer, the community will help you.
>> >
>> > 2017-08-28 21:40 GMT+08:00 Alexander Sterligov <st...@joom.it>:
>> >
>> >> Hi!
>> >>
>> >> It would be nice to have if-functions in kylin. What do you think?
>> >>
>> >> I've already implemented count_distinct_if, but I have problems adding
>> new
>> >> functions for BasicMeasureType.
>> >>
>> >> Best regards,
>> >> Alexander Sterligov
>> >>
>>
>
>