From 25e475898e8a8a183badf52c11c415e881987323 Mon Sep 17 00:00:00 2001 From: EmmyMiao87 <522274284@qq.com> Date: Thu, 30 Apr 2020 14:15:50 +0800 Subject: [PATCH] [Bug] Fix the error result when assert num rows node is used (#3436) The child.open() function is not called before this commit. If the assert num rows node has child which process data in open function, the assert num rows node will fetch no data from child. So the result will be empty(incorrect). This error only appear in inner subquery which has a aggregation function. For example: `select * from table where k1=(select k1 from (select avg(k1) from table) a);` The first level of subquery returns a non-scalar value, so the assert num rows node is needed. The second level of subquery has a aggregation function, so the child of assert node is aggregate node. However, if the open stage of the aggregate node is not called, the get next state of aggregate node will return empty set. So the result is wrong. Fixed #3435. --- be/src/exec/assert_num_rows_node.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/be/src/exec/assert_num_rows_node.cpp b/be/src/exec/assert_num_rows_node.cpp index 26112f65d1..407aeb0d95 100644 --- a/be/src/exec/assert_num_rows_node.cpp +++ b/be/src/exec/assert_num_rows_node.cpp @@ -45,6 +45,8 @@ Status AssertNumRowsNode::prepare(RuntimeState* state) { Status AssertNumRowsNode::open(RuntimeState* state) { SCOPED_TIMER(_runtime_profile->total_time_counter()); RETURN_IF_ERROR(ExecNode::open(state)); + // ISSUE-3435 + RETURN_IF_ERROR(child(0)->open(state)); return Status::OK(); }