diff --git a/be/src/exprs/hybrid_set.h b/be/src/exprs/hybrid_set.h index 03cde80c24..c45167a83b 100644 --- a/be/src/exprs/hybrid_set.h +++ b/be/src/exprs/hybrid_set.h @@ -421,7 +421,7 @@ public: void _insert_fixed_len_string(const auto& col, const uint8_t* __restrict nullmap, size_t start, size_t end) { for (size_t i = start; i < end; i++) { - if (nullmap != nullptr || !nullmap[i]) { + if (nullmap == nullptr || !nullmap[i]) { _set.insert(col.get_data_at(i).to_string()); } else { _contains_null = true; @@ -583,7 +583,7 @@ public: void _insert_fixed_len_string(const auto& col, const uint8_t* __restrict nullmap, size_t start, size_t end) { for (size_t i = start; i < end; i++) { - if (nullmap != nullptr || !nullmap[i]) { + if (nullmap == nullptr || !nullmap[i]) { _set.insert(col.get_data_at(i)); } else { _contains_null = true; diff --git a/regression-test/data/query_p0/join/no_null_str_rf/no_null_str_rf.out b/regression-test/data/query_p0/join/no_null_str_rf/no_null_str_rf.out new file mode 100644 index 0000000000..ebb4260eeb --- /dev/null +++ b/regression-test/data/query_p0/join/no_null_str_rf/no_null_str_rf.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !test -- +4 + diff --git a/regression-test/suites/query_p0/join/no_null_str_rf/no_null_str_rf.groovy b/regression-test/suites/query_p0/join/no_null_str_rf/no_null_str_rf.groovy new file mode 100644 index 0000000000..0b13db03a2 --- /dev/null +++ b/regression-test/suites/query_p0/join/no_null_str_rf/no_null_str_rf.groovy @@ -0,0 +1,58 @@ +// 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("no_null_str_rf") { + sql """ DROP TABLE IF EXISTS d_table; """ + sql """ DROP TABLE IF EXISTS dd_table; """ + sql """ + create table d_table( + k1 int null, + k2 int not null, + k3 bigint null, + k4 varchar(100) not null + ) + duplicate key (k1,k2,k3) + distributed BY hash(k1) buckets 3 + properties("replication_num" = "1"); + """ + + sql "insert into d_table select 1,1,1,'a';" + sql "insert into d_table select 1,1,1,'b';" + sql "insert into d_table select 1,1,1,'a';" + sql "insert into d_table select 1,1,1,'b';" + sql "insert into d_table select 1,1,1,'a';" + sql "insert into d_table select 1,1,1,'b';" + sql "insert into d_table select 1,1,1,'a';" + sql "insert into d_table select 1,1,1,'b';" + + sql """ + create table dd_table( + k1 int null, + k2 int not null, + k3 bigint null, + k4 varchar(100) not null + ) + duplicate key (k1,k2,k3) + distributed BY hash(k1) buckets 3 + properties("replication_num" = "1"); + """ + + sql "insert into dd_table select 1,1,1,'a';" + sql "insert into dd_table select 1,1,1,'c';" + + qt_test """select count(1) from d_table,dd_table where d_table.k4=dd_table.k4 and d_table.k1=1 and dd_table.k1=1;""" +}