You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@kylin.apache.org by "Jason Wang (WDG)" <ja...@microsoft.com> on 2016/02/10 23:40:12 UTC

FILTER clause not honored in query

After my cube is built,
"SELECT COUNT(*) FROM table" gives the correct result.
"SELECT COUNT(*) FROM table WHERE condition" also gives the correct result, but
"SELECT COUNT(*) FILTER (WHERE condition) FROM table" gives the wrong result - as if there is no filter at all.

It is common to have multiple aggregates in one query, each with different conditions. Without the FILTER clause, we will have to write multiple queries then combine the results together.

Re: FILTER clause not honored in query

Posted by Li Yang <li...@apache.org>.
Found an example in https://issues.apache.org/jira/browse/KYLIN-899

This is valid request and the JIRA is there. Will work on it.

On Fri, Feb 12, 2016 at 9:28 AM, Li Yang <li...@apache.org> wrote:

> Could you provide a full sql of the third case?  Just want to make sure we
> all understand the same problem.
>
> On Thu, Feb 11, 2016 at 6:40 AM, Jason Wang (WDG) <ja...@microsoft.com>
> wrote:
>
>> After my cube is built,
>>
>> “SELECT COUNT(*) FROM table” gives the correct result.
>>
>> “SELECT COUNT(*) FROM table WHERE condition” also gives the correct
>> result, but
>>
>> “SELECT COUNT(*) FILTER (WHERE condition) FROM table” gives the wrong
>> result – as if there is no filter at all.
>>
>>
>>
>> It is common to have multiple aggregates in one query, each with
>> different conditions. Without the FILTER clause, we will have to write
>> multiple queries then combine the results together.
>>
>
>

Re: FILTER clause not honored in query

Posted by Li Yang <li...@apache.org>.
Could you provide a full sql of the third case?  Just want to make sure we
all understand the same problem.

On Thu, Feb 11, 2016 at 6:40 AM, Jason Wang (WDG) <ja...@microsoft.com>
wrote:

> After my cube is built,
>
> “SELECT COUNT(*) FROM table” gives the correct result.
>
> “SELECT COUNT(*) FROM table WHERE condition” also gives the correct
> result, but
>
> “SELECT COUNT(*) FILTER (WHERE condition) FROM table” gives the wrong
> result – as if there is no filter at all.
>
>
>
> It is common to have multiple aggregates in one query, each with different
> conditions. Without the FILTER clause, we will have to write multiple
> queries then combine the results together.
>