Analytic plan optimization: taking advantage of the hash partitioning of the preceding aggregation.

- determine the partition group that has maximal intersection of its partition exprs with the
  preceding grouping exprs
- if that intersection's expected ndv > #nodes, make that partition group the first one in the sequence
  to be computed and reduce the hash partition of the preceding aggregation to that intersection

Change-Id: I612b4a260a8975deb495e5d34c32f03db4a7cca7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4451
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins