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 2024/01/12 01:09:21 UTC

(doris) branch master updated: [bug](rf) fix invalid type for runtime filters when result column is const (#29851)

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 ca9402be43c [bug](rf) fix invalid type for runtime filters when result column is const (#29851)
ca9402be43c is described below

commit ca9402be43c16da00ac151e7a0e76a464da33528
Author: zhangstar333 <87...@users.noreply.github.com>
AuthorDate: Fri Jan 12 09:09:14 2024 +0800

    [bug](rf) fix invalid type for runtime filters when result column is const (#29851)
---
 be/src/vec/exprs/vruntimefilter_wrapper.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/exprs/vruntimefilter_wrapper.cpp b/be/src/vec/exprs/vruntimefilter_wrapper.cpp
index 968bad5fedb..62ef2bbdb64 100644
--- a/be/src/vec/exprs/vruntimefilter_wrapper.cpp
+++ b/be/src/vec/exprs/vruntimefilter_wrapper.cpp
@@ -25,6 +25,7 @@
 
 #include "util/simd/bits.h"
 #include "vec/columns/column.h"
+#include "vec/columns/column_const.h"
 #include "vec/columns/column_nullable.h"
 #include "vec/columns/column_vector.h"
 #include "vec/core/block.h"
@@ -82,20 +83,29 @@ Status VRuntimeFilterWrapper::execute(VExprContext* context, Block* block, int*
         RETURN_IF_ERROR(_impl->execute(context, block, result_column_id));
         uint8_t* data = nullptr;
         const ColumnWithTypeAndName& result_column = block->get_by_position(*result_column_id);
-        if (auto* nullable = check_and_get_column<ColumnNullable>(*result_column.column)) {
+        if (is_column_const(*result_column.column)) {
+            auto* constant_val = const_cast<char*>(result_column.column->get_data_at(0).data);
+            if (constant_val == nullptr || !*reinterpret_cast<bool*>(constant_val)) {
+                _filtered_rows += block->rows();
+            }
+        } else if (const auto* nullable =
+                           check_and_get_column<ColumnNullable>(*result_column.column)) {
             data = ((ColumnVector<UInt8>*)nullable->get_nested_column_ptr().get())
                            ->get_data()
                            .data();
             _filtered_rows += doris::simd::count_zero_num(reinterpret_cast<const int8_t*>(data),
                                                           nullable->get_null_map_data().data(),
                                                           block->rows());
-        } else if (auto* res_col =
+        } else if (const auto* res_col =
                            check_and_get_column<ColumnVector<UInt8>>(*result_column.column)) {
             data = const_cast<uint8_t*>(res_col->get_data().data());
             _filtered_rows += doris::simd::count_zero_num(reinterpret_cast<const int8_t*>(data),
                                                           block->rows());
         } else {
-            return Status::InternalError("Invalid type for runtime filters!");
+            return Status::InternalError(
+                    "Invalid type for runtime filters!, and _expr_name is: {}. _data_type is: {}. "
+                    "result_column_id is: {}. block structure: {}.",
+                    _expr_name, _data_type->get_name(), *result_column_id, block->dump_structure());
         }
 
         calculate_filter(_filtered_rows, _scan_rows, _has_calculate_filter, _always_true);


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