PA: updates to run spilling with minimum required memory.

With this change, we can run partitioned aggs at the minimum required memory. This
value is a constant thats based on the io block size and fanout.

Change-Id: I8555c5216fa14d1ea66dcbcbeff266e2a754a012
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4209
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
IMPALA-1177: The AntiJoin code was not resetting correctly the hash table iterator

The AntiJoin code path was not resetting the hash table iterator when it was finding
a match for the current row. As a result the hash table iterator was pointing to the
wrong row when EvalConjuncts was being called.

Change-Id: I37bc457ccf999755f7f76ee30b24c5a12cb10a19
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4215
Reviewed-by: Ippokratis Pandis <ipandis@cloudera.com>
Tested-by: jenkins
IMPALA-1195: IllegalStateException in query with agg scalar subquery

This commit fixes IMPALA-1195 in which an exception is thrown when a
scalar subquery is in an IS NULL predicate. With this commit we also add
support for scalar subqueries in functions and other exprs.

Change-Id: Id995e77e6561a6450c4347706e4901fb3e236cfe
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4185
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Catch exception on Thrift client close()

Thrift's close() may call flush(), which calls write(), which may
throw. This patch catches that exception, logs and then ignores it.

Change-Id: I4952de1836531671546676ede40456e391b7c0d5
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4214
Reviewed-by: Daniel Hecht <dhecht@cloudera.com>
Tested-by: Henry Robinson <henry@cloudera.com>
Fix a few compilation warnings when building in release mode

Change-Id: I4741bf7088b3723eee9d0fb0d4cdeb1dc34ef7f0
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4228
Reviewed-by: Daniel Hecht <dhecht@cloudera.com>
Tested-by: Henry Robinson <henry@cloudera.com>
Move PHJ functions to IR file.

This patch only moves the ProcessBatch functions to the new file and
but doesn't make any changes to the functions. This will make rebasing
with my codegen patch much easier.

Change-Id: I0c45d64c743292e49714b7f86d4ab28c231c75ab
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4225
Reviewed-by: Nong Li <nong@cloudera.com>
Reviewed-by: Ippokratis Pandis <ipandis@cloudera.com>
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
PHJ: Add counters and fixing spilling.

With this patch, we should be able to run joins with FANOUT + 1 buffers
regardless of input size.

Change-Id: I6c71d9fabdaf42c4340a3d8340da0f84a4d611d7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4212
Tested-by: Nong Li <nong@cloudera.com>
Reviewed-by: Nong Li <nong@cloudera.com>
IMPALA-1203: Correlated agg subquery may be incorrectly rewritten if it
has a LIMIT clause

This commit fixes the issue where a correlated subquery with a LIMIT
clause produces wrong results. Correlated IN and EXISTS subqueries are
rejected if they contain a LIMIT clause because there is no correct
rewrite. For correlated agg subqueries the LIMIT clause is removed
because it does not affect the results.

Change-Id: I8eaaf57f2a9b7ec09a42ebf4c4231e9509706e8c
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4192
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Address Marcel's CR comments on analytic functions.

Change-Id: Ic2bf6412a6cc78a17fdb881d8d96448f5c965fce
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4252
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
Analytic tests without explicit final ordering should verify after sorting

Change-Id: Ic4ebd15af0d027eaded62f181e74bf41de93310a
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4264
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
[CDH5] Disable TestCancellationFullSort (see IMPALA-1240)

Change-Id: Id85aa2792b7e3bbf61837bb5399623d2810be72e