IMPALA-7851: fix underflow in ReserveSpace()
IMPALA-7851: fix underflow in ReserveSpace()

The (num_rows - start_idx) calculation was incorrect because
num_rows is *not* inclusive of start_idx - it is the number
of rows after start_idx to add to the output batch rather than
one past the last row to add.

(run_rows - start_idx) could then be negative, which results in
an underflow when it is implicitly converted to uint32_t.

The underflow could result in reserving huge amounts of memory in the
vector, which resulted in various misbehaviour such as hangs.

Testing:
Looped the test under ASAN. Before the fix it hung reliably. After it
succeeds quickly.

Change-Id: Iaec944f2149a6b9b605a5a885357fd54754dc046
Reviewed-on: http://gerrit.cloudera.org:8080/11976
Reviewed-by: Thomas Marshall <19143d3de8b13ab65aabdc921d14db5a16735b95@cmu.edu>
Tested-by: Tim Armstrong <2f8e34250f03a653da3dc27f7ec203eafdde80fc@cloudera.com>

cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala