IMPALA-4995: Fix integer overflow in TopNNode::PrepareForOutput
IMPALA-4995: Fix integer overflow in TopNNode::PrepareForOutput

To test this, Matt Mulder ran the failing query from IMPALA-4995 on a
private cluster and it did not crash. However the query did not finish
within several hours. We should switch to using the Sorter for large
TopN queries, as tracked by IMPALA-5004.

Change-Id: I5048ec67d8f086346220d56e027e6583fbb5ddad
Reviewed-on: http://gerrit.cloudera.org:8080/6171
Reviewed-by: Lars Volker <4d73c29a4561048ce85fa0051bb7a6d201781159@cloudera.com>
Tested-by: Impala Public Jenkins

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