Optimize aggregations over partition keys into simple metadata queries

Queries with the following shape are executed against partition metadata

```sql
SELECT min(key), max(key) FROM t
SELECT DISTINCT key FROM t
```
No, I was just thinking the connector might be broken and you will get an NPE.  I'd either bail out or fail explicitly.