HIVE-6120 Add GroupBy optimization to eliminate un-needed partial distinct aggregations
`
Fixed failures after HIVE-6120