Remove unused key from sample query
Add a check for valid aggregation types