IMPALA-1355: Allow spilling multiple partitions each time we need to spill.

Before, if we needed to spill, we'd spill a single partition and then try to
continue processing the current row. The spilled partition does not have to
be the partition that the row needs to go to. It is possible that after spilling
another partition, there is still not enough memory to process the row. This
can happen if something else (another query, or another part of this query) uses
the memory that was freed from spilling.

The query is only guaranteed to make indefinite progress when all the partitions
have been spilled and the reservation mechanism guarantees progress. This patch
does exactly that by repeatedly spilling partitions until we can accommodate the
row.

Change-Id: I1c515905c16be6f4950c1dc5cdc09338cfcf9e45
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4758
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Log leaks on release builds.

I suspect we're leaking on the cluster. Logging this will be helpful.

Change-Id: Ife39d0b8b091a56c098df066303b71ea97aa576a
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4759
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
IMPALA-1354: Disallow constant expressions in order by and partition by exprs

Postgres and Oracle allow constant expressions in the order by and partition exprs
which we don't currently handle properly when there are no other slots referenced.
In this case, the FE still produces a SortNode (though there's nothing to sort)
with an empty sort tuple and the BE crashes. Given that this is a strange corner
case that isn't really useful, we're just disallowing constant exprs in order by
and partition by exprs for now.

Change-Id: Ib2bcf8896a1fb7100c19e3a2bf4bfb92514feab9
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4765
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Fix metrics in IoMgr when returning IO buffers.

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