This is an automated email from the ASF dual-hosted git repository. lihaopeng pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new f4674f61a76 [Fix-2.0](column) Fix wrong has_null flag after filter_by_selector (#40849) f4674f61a76 is described below commit f4674f61a76fd2e774309849db6a5623b9c6a479 Author: zclllhhjj <zhaochan...@selectdb.com> AuthorDate: Fri Sep 20 19:04:11 2024 +0800 [Fix-2.0](column) Fix wrong has_null flag after filter_by_selector (#40849) in master and branch-2.1 it fixed by refactor https://github.com/apache/doris/pull/40769. for 2.0 we pick https://github.com/apache/doris/pull/40756 as a minimal modification --- be/src/vec/columns/column_nullable.cpp | 11 ++--- .../correctness/test_column_nullable_cache.out | 5 ++ .../correctness/test_column_nullable_cache.groovy | 57 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/be/src/vec/columns/column_nullable.cpp b/be/src/vec/columns/column_nullable.cpp index 47bd2d9e247..5dd612e6ced 100644 --- a/be/src/vec/columns/column_nullable.cpp +++ b/be/src/vec/columns/column_nullable.cpp @@ -365,15 +365,14 @@ size_t ColumnNullable::filter(const Filter& filter) { } Status ColumnNullable::filter_by_selector(const uint16_t* sel, size_t sel_size, IColumn* col_ptr) { - const ColumnNullable* nullable_col_ptr = reinterpret_cast<const ColumnNullable*>(col_ptr); + ColumnNullable* nullable_col_ptr = reinterpret_cast<ColumnNullable*>(col_ptr); ColumnPtr nest_col_ptr = nullable_col_ptr->nested_column; - ColumnPtr null_map_ptr = nullable_col_ptr->null_map; + // `get_null_map_data` will set `_need_update_has_null` to true + auto& res_nullmap = nullable_col_ptr->get_null_map_data(); + RETURN_IF_ERROR(get_nested_column().filter_by_selector( sel, sel_size, const_cast<doris::vectorized::IColumn*>(nest_col_ptr.get()))); - //insert cur nullmap into result nullmap which is empty - auto& res_nullmap = reinterpret_cast<vectorized::ColumnVector<UInt8>*>( - const_cast<doris::vectorized::IColumn*>(null_map_ptr.get())) - ->get_data(); + DCHECK(res_nullmap.empty()); res_nullmap.resize(sel_size); auto& cur_nullmap = get_null_map_column().get_data(); diff --git a/regression-test/data/correctness/test_column_nullable_cache.out b/regression-test/data/correctness/test_column_nullable_cache.out new file mode 100644 index 00000000000..024f1702b54 --- /dev/null +++ b/regression-test/data/correctness/test_column_nullable_cache.out @@ -0,0 +1,5 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !test -- + +-- !test -- +0 diff --git a/regression-test/suites/correctness/test_column_nullable_cache.groovy b/regression-test/suites/correctness/test_column_nullable_cache.groovy new file mode 100644 index 00000000000..c6ec7b73848 --- /dev/null +++ b/regression-test/suites/correctness/test_column_nullable_cache.groovy @@ -0,0 +1,57 @@ +// 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_column_nullable_cache") { + sql """ + drop table if exists test_column_nullable_cache; + """ + sql """ + CREATE TABLE `test_column_nullable_cache` ( + `col_int_undef_signed2` int NULL, + `col_int_undef_signed` int NULL, + `col_int_undef_signed3` int NULL, + `col_int_undef_signed4` int NULL, + `pk` int NULL + ) ENGINE=OLAP + DUPLICATE KEY(`col_int_undef_signed2`) + DISTRIBUTED by RANDOM BUCKETS 10 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ + insert into test_column_nullable_cache + (pk,col_int_undef_signed,col_int_undef_signed2,col_int_undef_signed3,col_int_undef_signed4) + values (0,3,7164641,5,8),(1,null,3916062,5,6),(2,1,5533498,0,9),(3,7,2,null,7057679),(4,1,0,7,7), + (5,null,4,2448564,1),(6,7531976,7324373,9,7),(7,3,1,1,3),(8,6,8131576,9,-1793807),(9,9,2,4214547,9), + (10,-7299852,5,1,3),(11,7,3,-1036551,5),(12,-6108579,84823,4,1229534),(13,-1065629,5,4,null),(14,null,8072633,3328285,2), + (15,2,7,6,6),(16,8,5,-4582103,1),(17,5,-4677722,-2379367,4),(18,-7807532,-6686732,0,5329341), + (19,8,7,-4013246,-7013374),(20,0,2,9,2),(21,7,2383333,5,4),(22,5844611,2,2,0),(23,0,4756185,0,-5612039), + (24,6,4878754,608172,0),(25,null,7858692,7,-6704206),(26,7,-1697597,6,9),(27,9,-7021349,3,-3094786), + (28,2,2830915,null,8),(29,4133633,489212,5,9),(30,6,-3346211,3668768,2),(31,1,4862070,-5066405,0),(32,9,6,7,8), + (33,2,null,4,2),(34,1,2893430,-3282825,5),(35,2,3,4,2),(36,4,-3418732,6,1263819),(37,5,4,-6342170,6),(99,9,2,8,null); + """ + + qt_test """ + select * from test_column_nullable_cache where col_int_undef_signed3 IS NULL and col_int_undef_signed3 = col_int_undef_signed3; + """ + + qt_test """ + select count(*) from test_column_nullable_cache where col_int_undef_signed3 IS NULL and col_int_undef_signed3 = col_int_undef_signed3; + """ +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org