You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/02/01 05:35:00 UTC

[jira] [Created] (CALCITE-3764) AggregateCaseToFilterRule handles NULL values correctly

Julian Hyde created CALCITE-3764:
------------------------------------

             Summary: AggregateCaseToFilterRule handles NULL values correctly
                 Key: CALCITE-3764
                 URL: https://issues.apache.org/jira/browse/CALCITE-3764
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


{{AggregateCaseToFilterRule}} handles NULL values correctly. It converts

{code:sql}
SELECT COUNT(CASE WHEN b THEN NULL ELSE 1 END) FROM t
{code}
to
{code:sql}
SELECT COUNT(*) FILTER (WHERE b IS FALSE) FROM t
{code}
which fails to count rows where {{b}} is UNKNOWN, so it should convert to
{code:sql}
SELECT COUNT(*) FILTER (WHERE b IS NOT TRUE) FROM t
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)