Add per client mem tracking to buffered block mgr.

This also means clients of the block mgr need to delete all blocks in close.
This is less important for sorting since it's typically at the end but will
be useful very soon.

Change-Id: Ia4ee188ad845540039ede5fe410a6048abe2bf5a
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3540
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Incorporate complex types in the analysis of subqueries

With this change we introduce a proper type for subqueries using the
recently added complex type hierarchy. The type of a subquery can be a
ScalarType, a StructType or an ArrayType depending on how many columns
and rows are returned by the subquery's statement. The subquery type is
used to simplify the analysis of subquery predicates.

Change-Id: I82e76fcb511397ca58c611f26e77fb764cfa21ae
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3547
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
Speed up codegen compile time by moving unnecessary files out of cross compiled module.

This gets us about a 10x speedup (700ms to 70ms) and back to where we were before.

Change-Id: I76d9f73b0b74ba7f45e3590e22d6541c560e9a58
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3570
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>