Update buffered block mgr to return blocks less than the io size.

Currently, the block mgr only returns io sized blocks. This is maximally
efficient for spilling for io.

For the PA/PHJ algorithms, we need maintain 1-2 buffers per partition. We'd
like a large fan out, to avoid requiring repartitioning. This means we currently
have a pretty high minimum buffering requirement.

e.g. 8MB buffers * 64 partitions * 2 buffers/partition = 1GB.

This value is required regardless of the number of rows; the query fails in
Open() right away. For our many high QPS simple queries, this would mean very
few queries can run concurrently and the memory is effectively wasted.

The solution we have is to support buffers (that never spill) that are small.
This patch does not implement that support in the tuple stream yet but if we
started with a 128K buffer, we'd have

128KB * 64 * 2 = 16MB minimum requirement which should be fine even in high
QPS env. Many queries will never need to grab bigger buffers.

This patch implements the block mgr support for smaller buffers. Exactly how
we use this in the tuple stream will come in the next patch.

Change-Id: Id1be5735d0219223ec6a2bbd05e2d40a713f3e32
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4289
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>
Simplify FIRST_VALUE analytic function implementation

Change-Id: I290adcaf50e9f5d5831eab4d67513d251e5fbe3e
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4418
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
IMPALA-1266: Fix missing row batch return in PHJ.

Change-Id: Id98e5748e75e7d2689b0aefb2813394b2bf1143d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4430
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>