IMPALA-1251: Fix hang for high-offset queries

If a row batch exceeded its memory capacity without containing any rows,
ExchangeNode::GetNextMerging() would spin in its loop which erroneously
expected at least one row to be produced by its child on every
iteration. The fix is to check for capacity once every time through the
loop and return to let operators up the line deal with the condition.

Change-Id: I2c015a4c91a7c1cf8b78f911273bb4f1ba87c9af
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4356
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 678d00193ef36740f0e590a5b7e4c1fe1f5d2cc2)
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4365
Reviewed-by: Henry Robinson <henry@cloudera.com>