IF was added in https://issues.apache.org/jira/browse/CALCITE-3731 and
will be part of 1.27 release. IF is a dialect-specific function,
enabled in bigquery, hive and spark function tables.

There are several other ways you can achieve the same effect:
 * COUNT(*) FILTER (WHERE a = 1)
 * COUNT(CASE a WHEN 1 THEN 1 END)
 * COUNT(CASE WHEN a = 1 THEN 1 END)
 * COUNTIF(a = 1) // from 1.27, and only in the BigQuery dialect

Julian

On Sat, Feb 20, 2021 at 10:39 AM you Zhuang <zhuangzixiao...@gmail.com> wrote:
>
> when does calcite support count(if(a=1, 1, null)) syntax ? spark, hive,
> clickhouse, impala, presto support the syntax for a long time.

Reply via email to