Fix multiple bugs in analytic fns BE and improved/consolidated tests

1) Fix ROWS following start bound where window is never fully in partition
2) Fix sum() NULL handling over sliding windows and add/consolidate tests.
   sum() should return NULL when all non-NULL values are removed. Because
   sum only stores the current sum as the intermediate value, we can't know
   if the sum is actually 0 or if there are no non-NULL values in the window.
   (avg() doesn't have this problem because it explicitly keeps the count
   of the number of elements in the average as part of the intermediate state.)
   Instead of changing sum() to have more intermediate state (which would
   affect aggregations), we can just keep track of the number of calls to
   Update() and Remove() in the FunctionContextImpl and check in SumRemove()
   whether or not there are any non-null elements being summed. Added
   tests (verified with Oracle).
3) Fixed a bug where the state tracking the last result tuple could be
   wrong and resulting in a crash.
4) IMPALA-1269: Windows between a start offset to CURRENT ROW might could
   produce wrong results between partitions.
5) IMPALA-1273: Incorrect results with very large window and small table

Tests are included for all issues.

Change-Id: I0f396c24078a1494fb977e8775f1ca8c530932eb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4397
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
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
Analytic Functions: Use predicates to check partition equality and ordering exprs

Changes AnalyticEvalNode to use predicates from planning to check
rows for partition equality and to compare rows over the order by
expressions.

Change-Id: I3fa4fd02683b7e157762c9d2dcbde09ab97ff2c3
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4408
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins