This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 99c601d989c [Fix](inverted index) fix fast execute for not_in expr (#37744) 99c601d989c is described below commit 99c601d989ce3da9917558e63d80cbae344a8b8c Author: airborne12 <airborn...@gmail.com> AuthorDate: Sat Jul 13 22:14:29 2024 +0800 [Fix](inverted index) fix fast execute for not_in expr (#37744) ## Proposed changes Pick from #37745 --- be/src/vec/exprs/vexpr.cpp | 2 +- be/src/vec/functions/function.h | 2 +- .../data/inverted_index_p0/test_index_rqg_bug3.out | 43 ++++++++++ .../inverted_index_p0/test_index_rqg_bug3.groovy | 97 ++++++++++++++++++++++ 4 files changed, 142 insertions(+), 2 deletions(-) diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp index 3a965c27c92..a0ba24115d1 100644 --- a/be/src/vec/exprs/vexpr.cpp +++ b/be/src/vec/exprs/vexpr.cpp @@ -627,7 +627,7 @@ std::string VExpr::gen_predicate_result_sign(Block& block, const ColumnNumbers& std::string column_name = block.get_by_position(arguments[0]).name; pred_result_sign += BeConsts::BLOCK_TEMP_COLUMN_PREFIX + column_name + "_" + function_name + "_"; - if (function_name == "in") { + if (function_name == "in" || function_name == "not_in") { // Generating 'result_sign' from 'inlist' requires sorting the values. std::set<std::string> values; for (size_t i = 1; i < arguments.size(); i++) { diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h index f3af3870c2e..36558c11df0 100644 --- a/be/src/vec/functions/function.h +++ b/be/src/vec/functions/function.h @@ -521,7 +521,7 @@ public: auto function_name = function->get_name(); return function_name == "eq" || function_name == "ne" || function_name == "lt" || function_name == "gt" || function_name == "le" || function_name == "ge" || - function_name == "in"; + function_name == "in" || function_name == "not_in"; } Status eval_inverted_index(FunctionContext* context, diff --git a/regression-test/data/inverted_index_p0/test_index_rqg_bug3.out b/regression-test/data/inverted_index_p0/test_index_rqg_bug3.out new file mode 100644 index 00000000000..cd01bedc787 --- /dev/null +++ b/regression-test/data/inverted_index_p0/test_index_rqg_bug3.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_bug_1 -- +-10 2023-12-11 +-10 2023-12-12 +-10 2023-12-13 +-10 2023-12-15 +-10 2023-12-15 +-10 2023-12-19 +-10 2023-12-19 +-10 2024-01-17 +-10 2024-02-18 +-10 2024-02-18 +-10 2025-02-18 +-10 2026-01-18 +-10 2026-02-18 +-4 2023-12-10 +-4 2023-12-11 +-4 2023-12-16 +-4 2024-01-31 +0 2024-01-19 +1 2023-12-16 +1 2024-01-09 +2 2023-12-10 +2 2023-12-11 +2 2024-01-08 +2 2024-01-31 +3 2023-12-20 +3 2024-01-19 +3 2025-06-18 +3 2026-02-18 +3 2027-01-16 +4 2023-12-12 +4 2023-12-12 +4 2024-01-08 +5 2023-12-16 +6 2024-02-18 +7 2023-12-17 +7 2023-12-20 +7 2027-01-09 +8 2025-02-18 +9 2024-02-18 +9 2024-02-18 + diff --git a/regression-test/suites/inverted_index_p0/test_index_rqg_bug3.groovy b/regression-test/suites/inverted_index_p0/test_index_rqg_bug3.groovy new file mode 100644 index 00000000000..4179ad3940e --- /dev/null +++ b/regression-test/suites/inverted_index_p0/test_index_rqg_bug3.groovy @@ -0,0 +1,97 @@ +// 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_index_rqg_bug3", "test_index_rqg_bug3"){ + def table1 = "test_index_rqg_bug3" + + sql "drop table if exists ${table1}" + + sql """ + CREATE TABLE ${table1} ( + `col_int_undef_signed_not_null` INT NOT NULL, + `col_date_undef_signed_not_null` DATE NOT NULL, + `col_bigint_undef_signed_not_null_index_inverted` BIGINT NOT NULL, + `col_bigint_undef_signed_not_null` BIGINT NOT NULL, + `col_int_undef_signed` INT NULL, + `col_int_undef_signed_index_inverted` INT NULL, + `col_int_undef_signed_not_null_index_inverted` INT NOT NULL, + `col_bigint_undef_signed` BIGINT NULL, + `col_bigint_undef_signed_index_inverted` BIGINT NULL, + `col_date_undef_signed` DATE NULL, + `col_date_undef_signed_index_inverted` DATE NULL, + `col_date_undef_signed_not_null_index_inverted` DATE NOT NULL, + `col_varchar_10__undef_signed` VARCHAR(10) NULL, + `col_varchar_10__undef_signed_index_inverted` VARCHAR(10) NULL, + `col_varchar_10__undef_signed_not_null` VARCHAR(10) NOT NULL, + `col_varchar_10__undef_signed_not_null_index_inverted` VARCHAR(10) NOT NULL, + `col_varchar_1024__undef_signed` VARCHAR(1024) NULL, + `col_varchar_1024__undef_signed_index_inverted` VARCHAR(1024) NULL, + `col_varchar_1024__undef_signed_not_null` VARCHAR(1024) NOT NULL, + `col_varchar_1024__undef_signed_not_null_index_inverted` VARCHAR(1024) NOT NULL, + `pk` INT NULL, + INDEX col_int_undef_signed_index_inverted_idx (`col_int_undef_signed_index_inverted`) USING INVERTED, + INDEX col_int_undef_signed_not_null_index_inverted_idx (`col_int_undef_signed_not_null_index_inverted`) USING INVERTED, + INDEX col_bigint_undef_signed_index_inverted_idx (`col_bigint_undef_signed_index_inverted`) USING INVERTED, + INDEX col_bigint_undef_signed_not_null_index_inverted_idx (`col_bigint_undef_signed_not_null_index_inverted`) USING INVERTED, + INDEX col_date_undef_signed_index_inverted_idx (`col_date_undef_signed_index_inverted`) USING INVERTED, + INDEX col_date_undef_signed_not_null_index_inverted_idx (`col_date_undef_signed_not_null_index_inverted`) USING INVERTED, + INDEX col_varchar_10__undef_signed_index_inverted_idx (`col_varchar_10__undef_signed_index_inverted`) USING INVERTED, + INDEX col_varchar_10__undef_signed_not_null_index_inverted_idx (`col_varchar_10__undef_signed_not_null_index_inverted`) USING INVERTED, + INDEX col_varchar_1024__undef_signed_index_inverted_idx (`col_varchar_1024__undef_signed_index_inverted`) USING INVERTED, + INDEX col_varchar_1024__undef_signed_not_null_index_inverted_idx (`col_varchar_1024__undef_signed_not_null_index_inverted`) USING INVERTED + ) ENGINE=OLAP + UNIQUE KEY(`col_int_undef_signed_not_null`, `col_date_undef_signed_not_null`, `col_bigint_undef_signed_not_null_index_inverted`, `col_bigint_undef_signed_not_null`) + DISTRIBUTED BY HASH(`col_bigint_undef_signed_not_null`) BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "min_load_replica_num" = "-1", + "is_being_synced" = "false", + "storage_medium" = "hdd", + "storage_format" = "V2", + "inverted_index_storage_format" = "V2", + "enable_unique_key_merge_on_write" = "true", + "light_schema_change" = "true", + "disable_auto_compaction" = "false", + "binlog.enable" = "false", + "binlog.ttl_seconds" = "86400", + "binlog.max_bytes" = "9223372036854775807", + "binlog.max_history_nums" = "9223372036854775807", + "enable_single_replica_compaction" = "false", + "group_commit_interval_ms" = "10000", + "group_commit_data_bytes" = "134217728", + "enable_mow_delete_on_delete_predicate" = "false" + ); + """ + + sql """ + insert into ${table1}(pk,col_int_undef_signed,col_int_undef_signed_index_inverted,col_int_undef_signed_not_null,col_int_undef_signed_not_null_index_inverted,col_bigint_undef_signed,col_bigint_undef_signed_index_inverted,col_bigint_undef_signed_not_null,col_bigint_undef_signed_not_null_index_inverted,col_date_undef_signed,col_date_undef_signed_index_inverted,col_date_undef_signed_not_null,col_date_undef_signed_not_null_index_inverted,col_varchar_10__undef_signed,col_varchar_10__undef_ [...] + """ + + qt_select_bug_1 """ + SELECT col_int_undef_signed_not_null, col_date_undef_signed_not_null + FROM ${table1} AS table1 + WHERE ( + NOT ( + ( + table1.`col_int_undef_signed_not_null` is NULL + ) + OR table1.col_varchar_1024__undef_signed_index_inverted IN ('h', 'j') + ) + OR table1.`col_date_undef_signed_not_null` IN ('2024-02-18') + ) + ORDER BY col_int_undef_signed_not_null, col_date_undef_signed_not_null; """ + +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org