This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 73d6ffc47d42cb2a706120d40d2241570406b021 Author: Pxl <[email protected]> AuthorDate: Sun Jan 29 17:23:21 2023 +0800 [Bug](exec) enable warning on ignoring function return value for vctx (#16157) * enable warning on ignoring function return value for vctx --- be/src/vec/core/sort_cursor.h | 6 +++--- be/src/vec/exec/join/process_hash_table_probe_impl.h | 10 +++++++--- be/src/vec/exec/vunion_node.cpp | 3 ++- be/src/vec/exprs/vexpr_context.h | 15 ++++++++------- be/src/vec/olap/vcollect_iterator.cpp | 2 +- be/test/vec/exprs/vexpr_test.cpp | 15 +++++++++++++-- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/be/src/vec/core/sort_cursor.h b/be/src/vec/core/sort_cursor.h index b13316fe40..a2174c3cb5 100644 --- a/be/src/vec/core/sort_cursor.h +++ b/be/src/vec/core/sort_cursor.h @@ -232,11 +232,11 @@ struct ReceiveQueueSortCursorImpl : public MergeSortCursorImpl { bool has_next_block() override { auto status = _block_supplier(&_block_ptr); if (status.ok() && _block_ptr != nullptr) { - for (int i = 0; i < desc.size(); ++i) { - _ordering_expr[i]->execute(_block_ptr, &desc[i].column_number); + for (int i = 0; status.ok() && i < desc.size(); ++i) { + status = _ordering_expr[i]->execute(_block_ptr, &desc[i].column_number); } MergeSortCursorImpl::reset(*_block_ptr); - return true; + return status.ok(); } _block_ptr = nullptr; return false; diff --git a/be/src/vec/exec/join/process_hash_table_probe_impl.h b/be/src/vec/exec/join/process_hash_table_probe_impl.h index 05499842cb..54319f782c 100644 --- a/be/src/vec/exec/join/process_hash_table_probe_impl.h +++ b/be/src/vec/exec/join/process_hash_table_probe_impl.h @@ -17,6 +17,7 @@ #pragma once +#include "common/status.h" #include "process_hash_table_probe.h" #include "vhash_join_node.h" @@ -232,9 +233,10 @@ Status ProcessHashTableProbe<JoinOpType>::do_process(HashTableType& hash_table_c ? decltype(key_getter.find_key(hash_table_ctx.hash_table, probe_index, *_arena)) {nullptr, false} : key_getter.find_key(hash_table_ctx.hash_table, probe_index, *_arena); - if (probe_index + PREFETCH_STEP < probe_rows) + if (probe_index + PREFETCH_STEP < probe_rows) { key_getter.template prefetch<true>(hash_table_ctx.hash_table, probe_index + PREFETCH_STEP, *_arena); + } if constexpr (JoinOpType == TJoinOp::LEFT_ANTI_JOIN || JoinOpType == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN) { @@ -414,9 +416,10 @@ Status ProcessHashTableProbe<JoinOpType>::do_process_with_other_join_conjuncts( ? decltype(key_getter.find_key(hash_table_ctx.hash_table, probe_index, *_arena)) {nullptr, false} : key_getter.find_key(hash_table_ctx.hash_table, probe_index, *_arena); - if (probe_index + PREFETCH_STEP < probe_rows) + if (probe_index + PREFETCH_STEP < probe_rows) { key_getter.template prefetch<true>(hash_table_ctx.hash_table, probe_index + PREFETCH_STEP, *_arena); + } if (find_result.is_found()) { auto& mapped = find_result.get_mapped(); auto origin_offset = current_offset; @@ -493,7 +496,8 @@ Status ProcessHashTableProbe<JoinOpType>::do_process_with_other_join_conjuncts( if (output_block->rows()) { int result_column_id = -1; int orig_columns = output_block->columns(); - (*_join_node->_vother_join_conjunct_ptr)->execute(output_block, &result_column_id); + RETURN_IF_ERROR((*_join_node->_vother_join_conjunct_ptr) + ->execute(output_block, &result_column_id)); auto column = output_block->get_by_position(result_column_id).column; if constexpr (JoinOpType == TJoinOp::LEFT_OUTER_JOIN || diff --git a/be/src/vec/exec/vunion_node.cpp b/be/src/vec/exec/vunion_node.cpp index e3343e25de..a18bb1215e 100644 --- a/be/src/vec/exec/vunion_node.cpp +++ b/be/src/vec/exec/vunion_node.cpp @@ -280,7 +280,8 @@ Block VUnionNode::materialize_block(Block* src_block) { ColumnsWithTypeAndName colunms; for (size_t i = 0; i < child_exprs.size(); ++i) { int result_column_id = -1; - child_exprs[i]->execute(src_block, &result_column_id); + auto state = child_exprs[i]->execute(src_block, &result_column_id); + CHECK(state.ok()) << state.to_string(); colunms.emplace_back(src_block->get_by_position(result_column_id)); } _child_row_idx += src_block->rows(); diff --git a/be/src/vec/exprs/vexpr_context.h b/be/src/vec/exprs/vexpr_context.h index b454833ed3..82ff9d11b8 100644 --- a/be/src/vec/exprs/vexpr_context.h +++ b/be/src/vec/exprs/vexpr_context.h @@ -28,11 +28,11 @@ class VExprContext { public: VExprContext(VExpr* expr); ~VExprContext(); - Status prepare(RuntimeState* state, const RowDescriptor& row_desc); - Status open(RuntimeState* state); + [[nodiscard]] Status prepare(RuntimeState* state, const RowDescriptor& row_desc); + [[nodiscard]] Status open(RuntimeState* state); void close(RuntimeState* state); - Status clone(RuntimeState* state, VExprContext** new_ctx); - Status execute(Block* block, int* result_column_id); + [[nodiscard]] Status clone(RuntimeState* state, VExprContext** new_ctx); + [[nodiscard]] Status execute(Block* block, int* result_column_id); VExpr* root() { return _root; } void set_root(VExpr* expr) { _root = expr; } @@ -53,9 +53,10 @@ public: return _fn_contexts[i]; } - static Status filter_block(VExprContext* vexpr_ctx, Block* block, int column_to_keep); - static Status filter_block(const std::unique_ptr<VExprContext*>& vexpr_ctx_ptr, Block* block, - int column_to_keep); + [[nodiscard]] static Status filter_block(VExprContext* vexpr_ctx, Block* block, + int column_to_keep); + [[nodiscard]] static Status filter_block(const std::unique_ptr<VExprContext*>& vexpr_ctx_ptr, + Block* block, int column_to_keep); static Block get_output_block_after_execute_exprs(const std::vector<vectorized::VExprContext*>&, const Block&, Status&); diff --git a/be/src/vec/olap/vcollect_iterator.cpp b/be/src/vec/olap/vcollect_iterator.cpp index cc07e9be30..cbcedb878a 100644 --- a/be/src/vec/olap/vcollect_iterator.cpp +++ b/be/src/vec/olap/vcollect_iterator.cpp @@ -137,7 +137,7 @@ Status VCollectIterator::build_heap(std::vector<RowsetReaderSharedPtr>& rs_reade if (!s.ok()) { delete (*iter); iter = _children.erase(iter); - if (!s.is<END_OF_FILE>()) { + if (!s.is_end_of_file()) { return s; } } else { diff --git a/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp index 593cfc932e..ca8f8938a8 100644 --- a/be/test/vec/exprs/vexpr_test.cpp +++ b/be/test/vec/exprs/vexpr_test.cpp @@ -71,8 +71,11 @@ TEST(TEST_VEXPR, ABSTEST) { doris::TQueryGlobals(), nullptr); runtime_stat.init_mem_trackers(); runtime_stat.set_desc_tbl(desc_tbl); - context->prepare(&runtime_stat, row_desc); - context->open(&runtime_stat); + auto state = doris::Status::OK(); + state = context->prepare(&runtime_stat, row_desc); + ASSERT_TRUE(state.ok()); + state = context->open(&runtime_stat); + ASSERT_TRUE(state.ok()); auto block = row_batch.convert_to_vec_block(); int ts = -1; @@ -116,12 +119,20 @@ TEST(TEST_VEXPR, ABSTEST2) { DescriptorTbl desc_tbl; desc_tbl._slot_desc_map[0] = tuple_desc->slots()[0]; runtime_stat.set_desc_tbl(&desc_tbl); +<<<<<<< HEAD context->prepare(&runtime_stat, row_desc); context->open(&runtime_stat); auto block = row_batch.convert_to_vec_block(); int ts = -1; context->execute(&block, &ts); +======= + auto state = Status::OK(); + state = context->prepare(&runtime_stat, row_desc); + ASSERT_TRUE(state.ok()); + state = context->open(&runtime_stat); + ASSERT_TRUE(state.ok()); +>>>>>>> 46347a51d2... [Bug](exec) enable warning on ignoring function return value for vctx (#16157) context->close(&runtime_stat); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
