You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/01/29 09:23:29 UTC

[doris] branch master updated: [Bug](exec) enable warning on ignoring function return value for vctx (#16157)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 46347a51d2 [Bug](exec) enable warning on ignoring function return value for vctx (#16157)
46347a51d2 is described below

commit 46347a51d2c2306d0052a2aae15fad52311586e3
Author: Pxl <px...@qq.com>
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/test/vec/exprs/vexpr_test.cpp                     | 14 ++++++++++----
 5 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/be/src/vec/core/sort_cursor.h b/be/src/vec/core/sort_cursor.h
index c267e0b66e..1f030781be 100644
--- a/be/src/vec/core/sort_cursor.h
+++ b/be/src/vec/core/sort_cursor.h
@@ -243,12 +243,12 @@ struct BlockSupplierSortCursorImpl : public MergeSortCursorImpl {
         auto status = _block_supplier(&_block_ptr);
         if (status.ok() && _block_ptr != nullptr) {
             if (_ordering_expr.size() > 0) {
-                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 19d7c014f6..096a54ed43 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"
 
@@ -239,9 +240,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) {
@@ -442,9 +444,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;
@@ -522,7 +525,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 daba4cc232..864780a9bb 100644
--- a/be/src/vec/exec/vunion_node.cpp
+++ b/be/src/vec/exec/vunion_node.cpp
@@ -330,7 +330,8 @@ Block VUnionNode::materialize_block(Block* src_block, int child_idx) {
     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/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp
index cacc350303..249733a484 100644
--- a/be/test/vec/exprs/vexpr_test.cpp
+++ b/be/test/vec/exprs/vexpr_test.cpp
@@ -56,8 +56,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());
     context->close(&runtime_stat);
 }
 
@@ -83,8 +86,11 @@ TEST(TEST_VEXPR, ABSTEST2) {
     DescriptorTbl desc_tbl;
     desc_tbl._slot_desc_map[0] = tuple_desc->slots()[0];
     runtime_stat.set_desc_tbl(&desc_tbl);
-    context->prepare(&runtime_stat, row_desc);
-    context->open(&runtime_stat);
+    auto state = Status::OK();
+    state = context->prepare(&runtime_stat, row_desc);
+    ASSERT_TRUE(state.ok());
+    state = context->open(&runtime_stat);
+    ASSERT_TRUE(state.ok());
     context->close(&runtime_stat);
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org