Fix a few bugs in AnalyticEvalNode

Fixes IMPALA-1200: resources for tuples may be returned in output batches too
early (i.e. the tuple may still be needed for rows that will be returned
later). We cannot just return resources after some number of tuples have been
allocated as they may still be needed, so this adds a second mem pool for
previously allocated tuples that can be transferred to output row batches. We
keep track of the last row containing resources in that pool so we can be sure
to only transfer the resources once that last row has been returned to the
parent.

Also addresses IMPALA-1206 (DCHECK failure)

Change-Id: I34b823ffb8d54263ea76e071d10ccae1cef0db99
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4187
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: Matthew Jacobs <mj@cloudera.com>