This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch dev-1.1.2 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/dev-1.1.2 by this push: new adabf53599 [enhancement](RowDescriptor) enhance tuple_idx check during runtime (#11835) adabf53599 is described below commit adabf53599cb391fc9be526e6aafea1cb6898924 Author: AlexYue <yj976240...@qq.com> AuthorDate: Wed Aug 17 17:50:48 2022 +0800 [enhancement](RowDescriptor) enhance tuple_idx check during runtime (#11835) --- be/src/exec/blocking_join_node.cpp | 5 ++++- be/src/exec/hash_join_node.cpp | 5 ++++- be/src/exec/set_operation_node.cpp | 5 ++++- be/src/exec/table_function_node.cpp | 5 +++-- be/src/exprs/tuple_is_null_predicate.cpp | 2 ++ be/src/runtime/descriptors.cpp | 6 +++++- be/src/runtime/descriptors.h | 7 +++++++ be/src/vec/exec/vblocking_join_node.cpp | 5 ++++- 8 files changed, 33 insertions(+), 7 deletions(-) diff --git a/be/src/exec/blocking_join_node.cpp b/be/src/exec/blocking_join_node.cpp index 382d626fb2..5eb21a9368 100644 --- a/be/src/exec/blocking_join_node.cpp +++ b/be/src/exec/blocking_join_node.cpp @@ -21,6 +21,7 @@ #include "exprs/expr.h" #include "gen_cpp/PlanNodes_types.h" +#include "runtime/descriptors.h" #include "runtime/row_batch.h" #include "runtime/runtime_state.h" #include "util/runtime_profile.h" @@ -63,7 +64,9 @@ Status BlockingJoinNode::prepare(RuntimeState* state) { for (int i = 0; i < _build_tuple_size; ++i) { TupleDescriptor* build_tuple_desc = child(1)->row_desc().tuple_descriptors()[i]; - _build_tuple_idx.push_back(_row_descriptor.get_tuple_idx(build_tuple_desc->id())); + auto tuple_idx = _row_descriptor.get_tuple_idx(build_tuple_desc->id()); + RETURN_IF_INVALID_TUPLE_IDX(build_tuple_desc->id(), tuple_idx); + _build_tuple_idx.push_back(tuple_idx); } _probe_tuple_row_size = num_left_tuples * sizeof(Tuple*); diff --git a/be/src/exec/hash_join_node.cpp b/be/src/exec/hash_join_node.cpp index 02f52d2124..515f7177bb 100644 --- a/be/src/exec/hash_join_node.cpp +++ b/be/src/exec/hash_join_node.cpp @@ -27,6 +27,7 @@ #include "exprs/runtime_filter.h" #include "exprs/slot_ref.h" #include "gen_cpp/PlanNodes_types.h" +#include "runtime/descriptors.h" #include "runtime/row_batch.h" #include "runtime/runtime_filter_mgr.h" #include "runtime/runtime_state.h" @@ -132,7 +133,9 @@ Status HashJoinNode::prepare(RuntimeState* state) { for (int i = 0; i < _build_tuple_size; ++i) { TupleDescriptor* build_tuple_desc = child(1)->row_desc().tuple_descriptors()[i]; - _build_tuple_idx.push_back(_row_descriptor.get_tuple_idx(build_tuple_desc->id())); + auto tuple_idx = _row_descriptor.get_tuple_idx(build_tuple_desc->id()); + RETURN_IF_INVALID_TUPLE_IDX(build_tuple_desc->id(), tuple_idx); + _build_tuple_idx.push_back(tuple_idx); } _probe_tuple_row_size = num_left_tuples * sizeof(Tuple*); _build_tuple_row_size = num_build_tuples * sizeof(Tuple*); diff --git a/be/src/exec/set_operation_node.cpp b/be/src/exec/set_operation_node.cpp index 7a9d3a334f..73557ec8b2 100644 --- a/be/src/exec/set_operation_node.cpp +++ b/be/src/exec/set_operation_node.cpp @@ -20,6 +20,7 @@ #include "exec/hash_table.hpp" #include "exprs/expr.h" #include "exprs/expr_context.h" +#include "runtime/descriptors.h" #include "runtime/raw_value.h" #include "runtime/row_batch.h" #include "runtime/runtime_state.h" @@ -58,7 +59,9 @@ Status SetOperationNode::prepare(RuntimeState* state) { for (int i = 0; i < _build_tuple_size; ++i) { TupleDescriptor* build_tuple_desc = child(0)->row_desc().tuple_descriptors()[i]; - _build_tuple_idx.push_back(_row_descriptor.get_tuple_idx(build_tuple_desc->id())); + auto tuple_idx = _row_descriptor.get_tuple_idx(build_tuple_desc->id()); + RETURN_IF_INVALID_TUPLE_IDX(build_tuple_desc->id(), tuple_idx); + _build_tuple_idx.push_back(tuple_idx); } _find_nulls = std::vector<bool>(); for (auto ctx : _child_expr_lists[0]) { diff --git a/be/src/exec/table_function_node.cpp b/be/src/exec/table_function_node.cpp index c2ed1f44a3..ff86df9601 100644 --- a/be/src/exec/table_function_node.cpp +++ b/be/src/exec/table_function_node.cpp @@ -268,8 +268,9 @@ Status TableFunctionNode::get_next(RuntimeState* state, RowBatch* row_batch, boo TupleDescriptor* child_tuple_desc = child_rowdesc.tuple_descriptors()[tuple_idx]; TupleDescriptor* parent_tuple_desc = parent_rowdesc.tuple_descriptors()[tuple_idx]; - Tuple* child_tuple = _cur_child_tuple_row->get_tuple( - child_rowdesc.get_tuple_idx(child_tuple_desc->id())); + auto tuple_idx = child_rowdesc.get_tuple_idx(child_tuple_desc->id()); + RETURN_IF_INVALID_TUPLE_IDX(child_tuple_desc->id(), tuple_idx); + Tuple* child_tuple = _cur_child_tuple_row->get_tuple(tuple_idx); // The child tuple is nullptr, only when the child tuple is from outer join. so we directly set // parent_tuple have same tuple_idx nullptr to mock the behavior diff --git a/be/src/exprs/tuple_is_null_predicate.cpp b/be/src/exprs/tuple_is_null_predicate.cpp index c0b0f2fe8c..ae9ebd761d 100644 --- a/be/src/exprs/tuple_is_null_predicate.cpp +++ b/be/src/exprs/tuple_is_null_predicate.cpp @@ -20,6 +20,7 @@ #include <sstream> #include "gen_cpp/Exprs_types.h" +#include "runtime/descriptors.h" namespace doris { @@ -36,6 +37,7 @@ Status TupleIsNullPredicate::prepare(RuntimeState* state, const RowDescriptor& r // Resolve tuple ids to tuple indexes. for (int i = 0; i < _tuple_ids.size(); ++i) { int32_t tuple_idx = row_desc.get_tuple_idx(_tuple_ids[i]); + RETURN_IF_INVALID_TUPLE_IDX(_tuple_ids[i], tuple_idx); if (row_desc.tuple_is_nullable(tuple_idx)) { _tuple_idxs.push_back(tuple_idx); } diff --git a/be/src/runtime/descriptors.cpp b/be/src/runtime/descriptors.cpp index 7b945cc271..a08dec9e6d 100644 --- a/be/src/runtime/descriptors.cpp +++ b/be/src/runtime/descriptors.cpp @@ -392,7 +392,11 @@ int RowDescriptor::get_row_size() const { } int RowDescriptor::get_tuple_idx(TupleId id) const { - CHECK_LT(id, _tuple_idx_map.size()) << "RowDescriptor: " << debug_string(); + // comment CHECK temporarily to make fuzzy test run smoothly + // DCHECK_LT(id, _tuple_idx_map.size()) << "RowDescriptor: " << debug_string(); + if (_tuple_idx_map.size() <= id) { + return RowDescriptor::INVALID_IDX; + } return _tuple_idx_map[id]; } diff --git a/be/src/runtime/descriptors.h b/be/src/runtime/descriptors.h index 21c0bc63c4..99dd07a6b2 100644 --- a/be/src/runtime/descriptors.h +++ b/be/src/runtime/descriptors.h @@ -361,6 +361,13 @@ private: DescriptorTbl() : _tbl_desc_map(), _tuple_desc_map(), _slot_desc_map() {} }; +#define RETURN_IF_INVALID_TUPLE_IDX(tuple_id, tuple_idx) \ + do { \ + if (UNLIKELY(RowDescriptor::INVALID_IDX == tuple_idx)) { \ + return Status::InternalError("failed to get tuple idx with tuple id: {}", tuple_id); \ + } \ + } while (false) + // Records positions of tuples within row produced by ExecNode. // TODO: this needs to differentiate between tuples contained in row // and tuples produced by ExecNode (parallel to PlanNode.rowTupleIds and diff --git a/be/src/vec/exec/vblocking_join_node.cpp b/be/src/vec/exec/vblocking_join_node.cpp index 9e7ccc82a2..b681437571 100644 --- a/be/src/vec/exec/vblocking_join_node.cpp +++ b/be/src/vec/exec/vblocking_join_node.cpp @@ -21,6 +21,7 @@ #include "exprs/expr.h" #include "gen_cpp/PlanNodes_types.h" +#include "runtime/descriptors.h" #include "runtime/runtime_state.h" #include "util/runtime_profile.h" @@ -54,7 +55,9 @@ Status VBlockingJoinNode::prepare(RuntimeState* state) { for (int i = 0; i < _build_tuple_size; ++i) { TupleDescriptor* build_tuple_desc = child(1)->row_desc().tuple_descriptors()[i]; - _build_tuple_idx.push_back(_row_descriptor.get_tuple_idx(build_tuple_desc->id())); + auto tuple_idx = _row_descriptor.get_tuple_idx(build_tuple_desc->id()); + RETURN_IF_INVALID_TUPLE_IDX(build_tuple_desc->id(), tuple_idx); + _build_tuple_idx.push_back(tuple_idx); } return Status::OK(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org