This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 28998300d43 [Bug](fix) fix ubsan use int32_t pointer access bool value
(#38621)
28998300d43 is described below
commit 28998300d4342f7c87d2e1d12e9725f432ec459a
Author: HappenLee <[email protected]>
AuthorDate: Thu Aug 1 13:52:12 2024 +0800
[Bug](fix) fix ubsan use int32_t pointer access bool value (#38621)
## Proposed changes
Issue Number: close #38617
<!--Describe your changes.-->
---
be/src/exprs/runtime_filter.cpp | 4 +-
.../query_p0/join/test_runtime_filter_boolean.out | 9 +++
.../join/test_runtime_filter_boolean.groovy | 64 ++++++++++++++++++++++
3 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/be/src/exprs/runtime_filter.cpp b/be/src/exprs/runtime_filter.cpp
index 0ea095e9a50..b03676d43c5 100644
--- a/be/src/exprs/runtime_filter.cpp
+++ b/be/src/exprs/runtime_filter.cpp
@@ -1755,8 +1755,8 @@ void IRuntimeFilter::to_protobuf(PMinMaxFilter* filter) {
switch (_wrapper->column_type()) {
case TYPE_BOOLEAN: {
- filter->mutable_min_val()->set_boolval(*reinterpret_cast<const
int32_t*>(min_data));
- filter->mutable_max_val()->set_boolval(*reinterpret_cast<const
int32_t*>(max_data));
+ filter->mutable_min_val()->set_boolval(*reinterpret_cast<const
bool*>(min_data));
+ filter->mutable_max_val()->set_boolval(*reinterpret_cast<const
bool*>(max_data));
return;
}
case TYPE_TINYINT: {
diff --git a/regression-test/data/query_p0/join/test_runtime_filter_boolean.out
b/regression-test/data/query_p0/join/test_runtime_filter_boolean.out
new file mode 100644
index 00000000000..5858b696341
--- /dev/null
+++ b/regression-test/data/query_p0/join/test_runtime_filter_boolean.out
@@ -0,0 +1,9 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !rf_bool --
+10 11
+10 11
+10 11
+110 11
+110 11
+110 11
+
diff --git
a/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy
b/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy
new file mode 100644
index 00000000000..e241909e79c
--- /dev/null
+++ b/regression-test/suites/query_p0/join/test_runtime_filter_boolean.groovy
@@ -0,0 +1,64 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_runtime_filter_boolean", "query_p0") {
+ sql "drop table if exists test_runtime_filter_boolean0;"
+ sql """ create table test_runtime_filter_boolean0(k1 int, v1 boolean)
+ DUPLICATE KEY(`k1`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+ properties("replication_num" = "1"); """
+
+ sql """insert into test_runtime_filter_boolean0 values
+ (10, false),
+ (10, false),
+ (10, false),
+ (110, false),
+ (110, false),
+ (110, false);"""
+
+ sql "drop table if exists test_runtime_filter_boolean1;"
+ sql """ create table test_runtime_filter_boolean1(k1 int, v1 boolean)
+ DUPLICATE KEY(`k1`)
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 1
+ properties("replication_num" = "1"); """
+
+ sql """insert into test_runtime_filter_boolean1 values
+ (11, false);"""
+
+
+ qt_rf_bool """
+ select
+ t0.k1, t1.k1
+ from
+ (
+ select
+ k1,
+ v1
+ from
+ test_runtime_filter_boolean0
+ ) t0
+ inner join [shuffle] (
+ select
+ k1,
+ v1
+ from
+ test_runtime_filter_boolean1
+ ) t1 on t0.v1 = t1.v1
+ order by
+ 1,2;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]