Analytic plan optimizations.

- order partition and sort groups by increasing output tuple size
- the unpartitioned partition group goes last
- if the unpartitioned partition group contains an order-by, that is executed like
  a regular distributed sort (with a merging exchange)
- coalesce sort groups that have a compatible partition-by clause and one is a prefix
  of the other

Still missing:
- ordering comparison should take equivalence classes into account

Change-Id: Ie604c74f7804a9028f3ab59ce0c291deb0edb272
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4399
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins