Skip to content

Support Selective Aggregations: FILTER clause to aggregate Functions #761

@mingmwang

Description

@mingmwang

PostgreSQL and SparkSQL support adding the FILTER clause to aggregate functions and this clause is quite useful when we want to count or sum specific records

SELECT SUM(age) FILTER (where name is not null), 
SUM(age) FILTER (where name is null) 
FROM EMPLOYEE;

https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-AGGREGATES

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions