This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 00c48f7d46 [opt](regression case) add more index change case (#21734) 00c48f7d46 is described below commit 00c48f7d4693058f17100d156a34d17192838508 Author: YueW <45946325+tany...@users.noreply.github.com> AuthorDate: Wed Jul 12 21:52:48 2023 +0800 [opt](regression case) add more index change case (#21734) --- be/src/olap/task/index_builder.cpp | 5 - .../index_change/test_index_change_7.out | 121 +++++++++++++++++++++ .../index_change/test_index_change_1.groovy | 2 - .../index_change/test_index_change_2.groovy | 2 - .../index_change/test_index_change_3.groovy | 2 - .../index_change/test_index_change_4.groovy | 2 - .../index_change/test_index_change_5.groovy | 2 - .../index_change/test_index_change_6.groovy | 2 - .../index_change/test_index_change_7.groovy | 118 ++++++++++++++++++++ 9 files changed, 239 insertions(+), 17 deletions(-) diff --git a/be/src/olap/task/index_builder.cpp b/be/src/olap/task/index_builder.cpp index 6af5e18d24..67e39104c6 100644 --- a/be/src/olap/task/index_builder.cpp +++ b/be/src/olap/task/index_builder.cpp @@ -398,11 +398,6 @@ Status IndexBuilder::do_build_inverted_index() { "failed to obtain build inverted index lock. tablet={}", _tablet->tablet_id()); } - if (_tablet->get_clone_occurred()) { - _tablet->set_clone_occurred(false); - return Status::Error<ErrorCode::BE_CLONE_OCCURRED>("get_clone_occurred failed"); - } - _input_rowsets = _tablet->pick_candidate_rowsets_to_build_inverted_index(_alter_index_ids, _is_drop_op); if (_input_rowsets.empty()) { diff --git a/regression-test/data/inverted_index_p0/index_change/test_index_change_7.out b/regression-test/data/inverted_index_p0/index_change/test_index_change_7.out new file mode 100644 index 0000000000..cb96edff04 --- /dev/null +++ b/regression-test/data/inverted_index_p0/index_change/test_index_change_7.out @@ -0,0 +1,121 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select1 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select2 -- +1 [10, 20, 30] ["i", "love", "china"] + +-- !select3 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select4 -- +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select5 -- +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select6 -- +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select7 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select8 -- +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select9 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N + +-- !select10 -- +1 [10, 20, 30] ["i", "love", "china"] + +-- !select11 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select12 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N + +-- !select13 -- +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select14 -- +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select15 -- +4 [40, 50, 60] \N + +-- !select16 -- +1 [10, 20, 30] ["i", "love", "china"] + +-- !select17 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select18 -- +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select19 -- +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select20 -- +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select21 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select22 -- +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select23 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N + +-- !select24 -- +1 [10, 20, 30] ["i", "love", "china"] + +-- !select25 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] + +-- !select26 -- +1 [10, 20, 30] ["i", "love", "china"] +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N + +-- !select27 -- +2 [20, 30, 40] ["i", "love", "north korea"] +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select28 -- +3 [30, 40, 50] \N +4 [40, 50, 60] \N + +-- !select29 -- +4 [40, 50, 60] \N + diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_1.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_1.groovy index 7fa805c0ba..9cfa77c587 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_1.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_1.groovy @@ -78,8 +78,6 @@ suite("test_index_change_1") { qt_select1 """ SELECT * FROM ${tableName} t ORDER BY user_id,date,city,age,sex; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // create inverted index sql """ CREATE INDEX idx_user_id ON ${tableName}(`user_id`) USING INVERTED """ sql """ CREATE INDEX idx_note ON ${tableName}(`note`) USING INVERTED PROPERTIES("parser"="english") """ diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_2.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_2.groovy index e80b805204..e146418038 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_2.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_2.groovy @@ -92,8 +92,6 @@ suite("test_index_change_2") { qt_select5 """ SELECT * FROM ${tableName} t WHERE note MATCH_PHRASE 'electrical engineer' ORDER BY user_id; """ qt_select6 """ SELECT * FROM ${tableName} t WHERE note MATCH 'engineer Developer' AND city match_all 'Shanghai China' ORDER BY user_id; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // create inverted index idx_city sql """ CREATE INDEX idx_city ON ${tableName}(`city`) USING INVERTED PROPERTIES("parser"="english") """ diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_3.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_3.groovy index deb77a028e..34a416f0d8 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_3.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_3.groovy @@ -92,8 +92,6 @@ suite("test_index_change_3") { qt_select5 """ SELECT * FROM ${tableName} t WHERE note MATCH_PHRASE 'electrical engineer' ORDER BY user_id; """ qt_select6 """ SELECT * FROM ${tableName} t WHERE note MATCH 'engineer Developer' AND city match_all 'Shanghai China' ORDER BY user_id; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // create inverted index idx_city sql """ CREATE INDEX idx_city ON ${tableName}(`city`) USING INVERTED PROPERTIES("parser"="english") """ // build index diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_4.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_4.groovy index 78c24ad660..6c0dbe463f 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_4.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_4.groovy @@ -92,8 +92,6 @@ suite("test_index_change_4") { qt_select5 """ SELECT * FROM ${tableName} t WHERE note MATCH_PHRASE 'electrical engineer' ORDER BY user_id; """ qt_select6 """ SELECT * FROM ${tableName} t WHERE note MATCH 'engineer Developer' AND city match_all 'Shanghai China' ORDER BY user_id; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // drop inverted index idx_user_id, idx_note sql """ DROP INDEX idx_user_id ON ${tableName} """ sql """ DROP INDEX idx_note ON ${tableName} """ diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_5.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_5.groovy index 4817d6f2d5..dd8a6b495a 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_5.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_5.groovy @@ -86,8 +86,6 @@ suite("test_index_change_5") { qt_select5 """ SELECT * FROM ${tableName} t WHERE note MATCH_PHRASE 'electrical engineer' ORDER BY user_id; """ qt_select6 """ SELECT * FROM ${tableName} t WHERE note MATCH 'engineer Developer' AND city match_all 'Shanghai China' ORDER BY user_id; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // drop inverted index idx_user_id, idx_note sql """ DROP INDEX idx_user_id ON ${tableName} """ sql """ DROP INDEX idx_note ON ${tableName} """ diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_6.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_6.groovy index c839fae0d0..45c68bd7ce 100644 --- a/regression-test/suites/inverted_index_p0/index_change/test_index_change_6.groovy +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_6.groovy @@ -92,8 +92,6 @@ suite("test_index_change_6") { qt_select5 """ SELECT * FROM ${tableName} t WHERE note MATCH_PHRASE 'electrical engineer' ORDER BY user_id; """ qt_select6 """ SELECT * FROM ${tableName} t WHERE note MATCH 'engineer Developer' AND city match_all 'Shanghai China' ORDER BY user_id; """ - //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,QueryHits,PathHash,MetaUrl,CompactionStatus - String[][] tablets = sql """ show tablets from ${tableName}; """ // drop inverted index idx_user_id, idx_note sql """ DROP INDEX idx_user_id ON ${tableName} """ sql """ DROP INDEX idx_note ON ${tableName} """ diff --git a/regression-test/suites/inverted_index_p0/index_change/test_index_change_7.groovy b/regression-test/suites/inverted_index_p0/index_change/test_index_change_7.groovy new file mode 100644 index 0000000000..f26cf6792f --- /dev/null +++ b/regression-test/suites/inverted_index_p0/index_change/test_index_change_7.groovy @@ -0,0 +1,118 @@ +// 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. + +import org.codehaus.groovy.runtime.IOGroovyMethods + +suite("test_index_change_7") { + def timeout = 60000 + def delta_time = 1000 + def alter_res = "null" + def useTime = 0 + def wait_for_build_index_on_partition_finish = { table_name, OpTimeout -> + for(int t = delta_time; t <= OpTimeout; t += delta_time){ + alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}";""" + def expected_finished_num = alter_res.size(); + def finished_num = 0; + for (int i = 0; i < expected_finished_num; i++) { + logger.info(table_name + " build index job state: " + alter_res[i][7] + i) + if (alter_res[i][7] == "FINISHED") { + ++finished_num; + } + } + if (finished_num == expected_finished_num) { + logger.info(table_name + " all build index jobs finished, detail: " + alter_res) + break + } + useTime = t + sleep(delta_time) + } + assertTrue(useTime <= OpTimeout, "wait_for_latest_build_index_on_partition_finish timeout") + } + + def tableName = "test_index_change_7" + + sql """ DROP TABLE IF EXISTS ${tableName} """ + + sql """ + CREATE TABLE IF NOT EXISTS ${tableName}( + `id`int(11)NULL, + `int_array` array<int(20)> NULL, + `c_array` array<varchar(20)> NULL, + INDEX c_array_idx(`c_array`) USING INVERTED PROPERTIES("parser"="english") COMMENT 'c_array index', + INDEX int_array_idx(`int_array`) USING INVERTED COMMENT 'int_array index' + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + COMMENT 'OLAP' + DISTRIBUTED BY HASH(`id`) BUCKETS 1 + PROPERTIES( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql "INSERT INTO ${tableName} VALUES (1, [10,20,30], ['i','love','china']), (2, [20,30,40], ['i','love','north korea']), (3, [30,40,50], NULL);" + sql "INSERT INTO ${tableName} VALUES (4, [40,50,60], NULL);" + + qt_select1 """ SELECT * FROM ${tableName} t ORDER BY id; """ + qt_select2 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'china' ORDER BY id; """ + qt_select3 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'love' ORDER BY id; """ + qt_select4 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'north' ORDER BY id; """ + qt_select5 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'korea' ORDER BY id; """ + qt_select6 """ SELECT * FROM ${tableName} t WHERE int_array element_ge 40 ORDER BY id; """ + qt_select7 """ SELECT * FROM ${tableName} t WHERE int_array element_le 40 ORDER BY id; """ + qt_select8 """ SELECT * FROM ${tableName} t WHERE int_array element_gt 40 ORDER BY id; """ + qt_select9 """ SELECT * FROM ${tableName} t WHERE int_array element_lt 40 ORDER BY id; """ + qt_select10 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 10 ORDER BY id; """ + qt_select11 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 20 ORDER BY id; """ + qt_select12 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 30 ORDER BY id; """ + qt_select13 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 40 ORDER BY id; """ + qt_select14 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 50 ORDER BY id; """ + qt_select15 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 60 ORDER BY id; """ + + // drop inverted index c_array_idx, int_array_idx + sql """ DROP INDEX c_array_idx ON ${tableName} """ + sql """ DROP INDEX int_array_idx ON ${tableName} """ + + // create inverted index + sql """ CREATE INDEX c_array_idx ON ${tableName}(`c_array`) USING INVERTED PROPERTIES("parser"="english") """ + sql """ CREATE INDEX int_array_idx ON ${tableName}(`int_array`) USING INVERTED """ + + // build inverted index + sql """ BUILD INDEX c_array_idx ON ${tableName} """ + sql """ BUILD INDEX int_array_idx ON ${tableName} """ + wait_for_build_index_on_partition_finish(tableName, timeout) + + def show_result = sql "show index from ${tableName}" + logger.info("show index from " + tableName + " result: " + show_result) + assertEquals(show_result.size(), 2) + assertEquals(show_result[0][2], "c_array_idx") + assertEquals(show_result[1][2], "int_array_idx") + + qt_select16 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'china' ORDER BY id; """ + qt_select17 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'love' ORDER BY id; """ + qt_select18 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'north' ORDER BY id; """ + qt_select19 """ SELECT * FROM ${tableName} t WHERE c_array MATCH 'korea' ORDER BY id; """ + qt_select20 """ SELECT * FROM ${tableName} t WHERE int_array element_ge 40 ORDER BY id; """ + qt_select21 """ SELECT * FROM ${tableName} t WHERE int_array element_le 40 ORDER BY id; """ + qt_select22 """ SELECT * FROM ${tableName} t WHERE int_array element_gt 40 ORDER BY id; """ + qt_select23 """ SELECT * FROM ${tableName} t WHERE int_array element_lt 40 ORDER BY id; """ + qt_select24 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 10 ORDER BY id; """ + qt_select25 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 20 ORDER BY id; """ + qt_select26 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 30 ORDER BY id; """ + qt_select27 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 40 ORDER BY id; """ + qt_select28 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 50 ORDER BY id; """ + qt_select29 """ SELECT * FROM ${tableName} t WHERE int_array element_eq 60 ORDER BY id; """ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org