Fix memory leak in PartitionedAggNode

Change-Id: Ifedffde3d67102bf8e4ab5a46d68812f49341bdb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4809
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Speed up the parquet writer's dictionary encoder

Using TPC-H lineitem data, the speedup for the dictionary encoded
columns (as measured by EncodeTimer) is:
Before: 63 seconds, After: 45 seconds, Speed-up: 29%

Previously, the dictionary encoder was based on boost's unordered_map,
which does a modulo by the size of the hash table (prime number). This
divide instruction accounts for the largest overhead of our dictionary
encoder, and is unavoidable when using unordered_map.

So, replace it with our own simple custom hash table implementation.
This also allows us to be several times more space efficient (by using
offsets rather than full 64-bit pointers, singly linked chains, storing
values only once for both the forward and reverse mappings, etc).
That's a nice bonus since this overhead grows with the number of
columns, and has lower cache footprint.

Also avoid the num_entries() virtual call in EncodeValue(), which seems
to save about 1% of a CPU core.

This doesn't bother with rehashing/growing the table's capacity since
the overhead is reasonably small for a 64K entry fixed table (128K
bytes). Non-dictionary encoded columns end up growing to the maximum
size anyway.

This also fixes IMPALA-1254 by checking for conditions that should end a
datapage before adding the value.

Change-Id: I2a595226e3a11797d1953f05a6ec8123679fd7bb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4786
Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com>
Tested-by: jenkins