Skip to content

Commit

Permalink
[Bug](fix) fix ubsan use int32_t pointer access bool value #38617 (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
HappenLee authored Aug 1, 2024
1 parent 5cb03e9 commit 739e524
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
4 changes: 2 additions & 2 deletions be/src/exprs/runtime_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,8 +1725,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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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;
"""
}

0 comments on commit 739e524

Please sign in to comment.