IMPALA-1332: Fix memory leak for FULL OUTER/RIGHT OUTER joins.

This can happen if not all rows are returned.

Change-Id: I4d54641b71c44faa85a2138d16f9dda1052317b5
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4737
Tested-by: jenkins
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
This commit is contained in:
Nong Li
2014-10-03 13:33:52 -07:00
parent 652d4b4699
commit a2e7b05bb1
3 changed files with 17 additions and 1 deletions

View File

@@ -187,6 +187,11 @@ void PartitionedHashJoinNode::Close(RuntimeState* state) {
it != spilled_partitions_.end(); ++it) {
(*it)->Close(NULL);
}
for (list<Partition*>::iterator it = output_build_partitions_.begin();
it != output_build_partitions_.end(); ++it) {
(*it)->Close(NULL);
}
if (input_partition_ != NULL) input_partition_->Close(NULL);
if (null_aware_partition_ != NULL) null_aware_partition_->Close(NULL);
if (null_probe_rows_ != NULL) null_probe_rows_->Close();

View File

@@ -151,9 +151,9 @@ Status UnionNode::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) {
// transfered all resources. It is not OK to close the child above in the case when
// ReachedLimit() is true as we may end up releasing resources that are referenced
// by the output row_batch.
child_row_batch_.reset();
child(child_idx_)->Close(state);
++child_idx_;
child_row_batch_.reset();
}
// Evaluate and materialize the const expr lists exactly once.

View File

@@ -614,3 +614,14 @@ LEFT JOIN alltypesagg t3 ON t3.id = t2.tinyint_col
---- TYPES
BIGINT
====
---- QUERY
# Regression test for IMPALA-1332
select a.int_col from alltypesagg a
RIGHT OUTER JOIN alltypesagg b
using(int_col)
where a.int_col is NULL limit 1
---- RESULTS
NULL
---- TYPES
INT
====