IMPALA-1251: Fix hang for high-offset queries
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 <99a5e5f8f5911755b88e0b536d46aafa102bed41@cloudera.com>
Tested-by: jenkins
(cherry picked from commit 678d00193ef36740f0e590a5b7e4c1fe1f5d2cc2)
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4365
Reviewed-by: Henry Robinson <3eca10f30041813f045165784e24b5a950a6cc7e@cloudera.com>

cloudera/Impala,michaelhkw/incubator-impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,michaelhkw/incubator-impala,cloudera/Impala,michaelhkw/incubator-impala,cloudera/Impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,michaelhkw/incubator-impala,cloudera/Impala