Optimize cardinality-insensitiv aggregations over partition keys

This optimization rewrites aggregations that are insensitive to the
cardinality of their input (i.e., min, max, distinct aggregates) as
partition metadata queries when the input columns are only partition keys

These are a few examples of queries that benefit:

    SELECT min(key), max(key) FROM t

    SELECT DISTINCT key FROM t

    SELECT count(DISTINCT key) FROM t

    SELECT count(DISTINCT key + 5) FROM t

    SELECT count(DISTINCT key) FROM (SELECT key FROM t ORDER BY 1 LIMIT 10);