mirror of
https://github.com/apache/impala.git
synced 2026-01-08 12:02:54 -05:00
This patch changes the ExecNode::Reset() to: Status ExecNode::Reset(RuntimeState* state); The new Reset() should only clear the internal state of an exec node in preparation for another Open()/GetNext()*. Reset() should not clear memory backing rows returned by a node in GetNext() because those rows could still be in flight. Subplan Memory Management: To ensure that the memory backing rows produced by the subplan tree of a SubplanExecNode remains valid for the lifetime a row batch, we intend to use our conventional transfer mechanism. That is, the ownership of memory that is no longer used by an exec node is transferred to an output row batch in GetNext() at a "convenient" point, typically at eos or when the memory usage exceeds some threshold. Note that exec nodes may choose not to transfer memory at eos to amortize the cost of memory allocation over multiple Reset()/Open()/GetNext()* cycles. To show the main ideas, this patch fixes transferring of tuple data ownership in several places and implements Reset() for the following nodes: - AnalyticEvalNode - BlockingJoinNode - CrossJoinNode - SelectNode - SortNode - TopNNode - UnionNode To make the transfer of ownership work for SortNode a row batch can now also own a list of BufferdBlockMgr::Block*. Also included are basic query tests that are not meant to be exhaustive. The tests are disabled for now because we cannot run them without several other code changes. I have manually run the test queries on a branch that has all necessary changes. Change-Id: I3ac94b8dd7c7eb48f2e639ea297b447fbf443185 Reviewed-on: http://gerrit.cloudera.org:8080/454 Reviewed-by: Alex Behm <alex.behm@cloudera.com> Tested-by: Internal Jenkins