forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] (inverted index) add some regression cases (apache#42131)
## Proposed changes I cherry-picked the regression test cases for issues fixed in branch-2.0 and branch-2.1 to ensure the correctness of the master branch. apache#41200 apache#41297 apache#40425 apache#40630
- Loading branch information
Showing
8 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
regression-test/data/inverted_index_p0/test_index_rqg_bug5.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !sql -- | ||
1 | ||
|
7 changes: 7 additions & 0 deletions
7
regression-test/data/inverted_index_p0/test_index_rqg_bug6.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !sql -- | ||
1 | ||
|
||
-- !sql_2 -- | ||
3 | ||
|
4 changes: 4 additions & 0 deletions
4
regression-test/data/inverted_index_p0/test_index_rqg_bug7.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !sql -- | ||
2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ | |
-- !sql -- | ||
1 | ||
|
||
-- !sql_11 -- | ||
1 | ||
|
38 changes: 38 additions & 0 deletions
38
regression-test/suites/inverted_index_p0/test_index_rqg_bug5.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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_bug5", "test_index_rqg_bug"){ | ||
def table = "test_index_rqg_bug5" | ||
sql "drop table if exists ${table}" | ||
|
||
sql """ | ||
create table ${table} ( | ||
pk int, | ||
col1 int not null, | ||
col2 bigint not null, | ||
INDEX col1_idx (`col1`) USING INVERTED, | ||
INDEX col2_idx (`col2`) USING INVERTED | ||
) engine=olap | ||
DUPLICATE KEY(pk, col1) | ||
distributed by hash(pk) | ||
properties("replication_num" = "1");; | ||
""" | ||
|
||
sql """ insert into ${table} values (10, 20, 30); """ | ||
|
||
qt_sql """ select count() from ${table} where col2 + col1 > 20 or col1 > 20; """ | ||
} |
63 changes: 63 additions & 0 deletions
63
regression-test/suites/inverted_index_p0/test_index_rqg_bug6.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// 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_bug6", "test_index_rqg_bug"){ | ||
def table = "test_index_rqg_bug6" | ||
|
||
sql "drop table if exists ${table}" | ||
|
||
sql """ | ||
create table ${table} ( | ||
pk int, | ||
col_int_undef_signed_index_inverted int not null , | ||
col_varchar_1024__undef_signed_not_null varchar(1024) not null, | ||
INDEX col_int_undef_signed_index_inverted_idx (`col_int_undef_signed_index_inverted`) USING INVERTED, | ||
INDEX col_varchar_1024__undef_signed_not_null_idx (`col_varchar_1024__undef_signed_not_null`) USING INVERTED | ||
) engine=olap | ||
DUPLICATE KEY(pk) | ||
distributed by hash(pk) buckets 1 | ||
properties("replication_num" = "1"); | ||
""" | ||
|
||
sql """ insert into ${table} values (10, 0, 'ok'), (11, 0, 'oo'), (12, 1, 'ok')""" | ||
|
||
|
||
sql """ sync""" | ||
sql """ set enable_inverted_index_query = true """ | ||
sql """ set inverted_index_skip_threshold = 0 """ | ||
qt_sql """ | ||
SELECT | ||
count() | ||
FROM | ||
test_index_rqg_bug6 | ||
WHERE | ||
IF(col_int_undef_signed_index_inverted = 0, 'true', 'false') = 'false' | ||
AND ( | ||
col_varchar_1024__undef_signed_not_null LIKE 'ok' | ||
OR col_int_undef_signed_index_inverted = 0 | ||
); | ||
""" | ||
|
||
qt_sql_2 """ | ||
SELECT | ||
count() | ||
FROM | ||
test_index_rqg_bug6 | ||
WHERE | ||
col_varchar_1024__undef_signed_not_null LIKE 'ok' | ||
OR col_int_undef_signed_index_inverted = 0; | ||
""" | ||
} |
44 changes: 44 additions & 0 deletions
44
regression-test/suites/inverted_index_p0/test_index_rqg_bug7.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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_bug7", "test_index_rqg_bug"){ | ||
def table = "test_index_rqg_bug7" | ||
|
||
sql "drop table if exists ${table}" | ||
|
||
sql """ | ||
create table ${table} ( | ||
pk int, | ||
col_int_undef_signed int null , | ||
col_int_undef_signed_not_null_index_inverted int not null , | ||
INDEX col_int_undef_signed_not_null_index_inverted_idx (`col_int_undef_signed_not_null_index_inverted`) USING INVERTED | ||
) engine=olap | ||
DUPLICATE KEY(pk) | ||
distributed by hash(pk) buckets 10 | ||
properties("replication_num" = "1"); | ||
""" | ||
|
||
sql """ insert into ${table} values (1, 7, 7), (2, 7, -2), (3, 4, -2)""" | ||
|
||
|
||
sql """ sync""" | ||
sql """ set enable_inverted_index_query = true """ | ||
sql """ set inverted_index_skip_threshold = 0 """ | ||
sql """ set enable_no_need_read_data_opt = true """ | ||
qt_sql """ | ||
select count(*) from ${table} where col_int_undef_signed_not_null_index_inverted = -2 AND ((CASE WHEN col_int_undef_signed_not_null_index_inverted = -2 THEN 1 ELSE NULL END = 1) OR col_int_undef_signed != 7); | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters