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;