From 59d64f429a274bf1f8dfcff61f71bab681cfeade Mon Sep 17 00:00:00 2001 From: bobhan1 Date: Wed, 18 Dec 2024 15:58:15 +0800 Subject: [PATCH] add read scenarios case --- ...t_key_bounds_truncation_read_scenarios.out | 81 ++++++++++++------- ...ey_bounds_truncation_read_scenarios.groovy | 45 ++++++----- 2 files changed, 81 insertions(+), 45 deletions(-) diff --git a/regression-test/data/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.out b/regression-test/data/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.out index 30087ad3e53eed7..07b0edba4b0d79d 100644 --- a/regression-test/data/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.out +++ b/regression-test/data/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.out @@ -1,30 +1,57 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !sql -- -aaaaaaaabbb1 1 1 1 -aaaaaaaabbb2 1 1 1 -aaaaaaaabbb3 1 1 1 -aaaaaaaabbb4 1 1 1 -aaaaaaaabbb5 1 1 1 -aaaaaaaabbb6 1 1 1 -aaaaaaaabbb7 1 1 1 -aaaaaaaabbb8 1 1 1 -aaaaaaaabbb9 1 1 1 -aaaaaaaaccc1 2 2 2 -aaaaaaaaccc2 2 2 2 -aaaaaaaaccc3 2 2 2 -aaaaaaaaccc4 2 2 2 -aaaaaaaaccc5 2 2 2 -aaaaaaaaccc6 2 2 2 -aaaaaaaaccc7 2 2 2 -aaaaaaaaccc8 2 2 2 -aaaaaaaaccc9 2 2 2 -aaaaaaaaddd1 3 3 3 -aaaaaaaaddd2 3 3 3 -aaaaaaaaddd3 3 3 3 -aaaaaaaaddd4 3 3 3 -aaaaaaaaddd5 3 3 3 -aaaaaaaaddd6 3 3 3 -aaaaaaaaddd7 3 3 3 -aaaaaaaaddd8 3 3 3 -aaaaaaaaddd9 3 3 3 +3757202 1 1 9 +3757202 1 2 8 +3757202 1 3 7 +3757202 2 1 9 +3757202 2 2 8 +3757202 2 3 7 +3757202 3 1 9 +3757202 3 2 8 +3757202 3 3 7 +3757202 4 1 9 +3757202 4 2 8 +3757202 4 3 7 +3757202 5 1 9 +3757202 5 2 8 +3757202 5 3 7 +3757202 6 1 9 +3757202 6 2 8 +3757202 6 3 7 +3757202 7 1 9 +3757202 7 2 8 +3757202 7 3 7 +3757202 8 1 9 +3757202 8 2 8 +3757202 8 3 7 +3757202 9 1 9 +3757202 9 2 8 +3757202 9 3 7 + +-- !sql -- +3757202 1 1 9 + +-- !sql -- +3757202 2 1 9 + +-- !sql -- +3757202 3 1 9 + +-- !sql -- +3757202 4 1 9 + +-- !sql -- +3757202 5 1 9 + +-- !sql -- +3757202 6 1 9 + +-- !sql -- +3757202 7 1 9 + +-- !sql -- +3757202 8 1 9 + +-- !sql -- +3757202 9 1 9 diff --git a/regression-test/suites/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.groovy b/regression-test/suites/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.groovy index 8e142f6aeaf7e28..bba58d9acbc3ed5 100644 --- a/regression-test/suites/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.groovy +++ b/regression-test/suites/unique_with_mow_p0/key_bounds/test_key_bounds_truncation_read_scenarios.groovy @@ -25,16 +25,19 @@ import org.awaitility.Awaitility suite("test_key_bounds_truncation_read_scenarios", "nonConcurrent") { def tableName = "test_key_bounds_truncation_read_scenarios" - sql """ DROP TABLE IF EXISTS ${tableName} force;""" - sql """ CREATE TABLE ${tableName} ( - `k` varchar(65533) NOT NULL, - `v1` int, - v2 int, - v3 int ) - UNIQUE KEY(`k`) DISTRIBUTED BY HASH(`k`) BUCKETS 1 - PROPERTIES("replication_num" = "1", - "enable_unique_key_merge_on_write" = "true", - "disable_auto_compaction" = "true"); """ + + sql "DROP TABLE IF EXISTS ${tableName}" + sql """ + CREATE TABLE `${tableName}` ( + `k1` int NOT NULL, + `k2` int NOT NULL, + `k3` int NOT NULL, + `c1` int NOT NULL ) + ENGINE=OLAP UNIQUE KEY(k1,k2,k3) + DISTRIBUTED BY HASH(k1,k2,k3) BUCKETS 1 + PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "disable_auto_compaction"="true", + "store_row_column" = "true", "enable_mow_light_delete" = "false" ); + """ def getRowsetMetas = { int version -> def metaUrl = sql_return_maparray("show tablets from ${tableName};").get(0).MetaUrl @@ -51,7 +54,7 @@ suite("test_key_bounds_truncation_read_scenarios", "nonConcurrent") { def rowsetMeta = getRowsetMetas(version) def keyBounds = rowsetMeta.segments_key_bounds - logger.info("\nsegments_key_bounds_truncated=${rowsetMeta.segments_key_bounds_truncated}, turnedOn=${turnedOn}") + logger.info("\nversion=${version}, segments_key_bounds_truncated=${rowsetMeta.segments_key_bounds_truncated}, turnedOn=${turnedOn}") assertEquals(turnedOn, rowsetMeta.segments_key_bounds_truncated) for (def bounds : keyBounds) { @@ -71,22 +74,28 @@ suite("test_key_bounds_truncation_read_scenarios", "nonConcurrent") { setBeConfigTemporary(customBeConfig) { // 1. mow load + int k1 = 3757202 for (int j=1;j<=10;j++) { for (int i=1;i<=9;i++) { - String k1 = "aaaaaaaabbb${i}" - String k2 = "aaaaaaaaccc${i}" - String k3 = "aaaaaaaaddd${i}" - sql """insert into ${tableName} values("${k1}",1,1,1),("${k2}",2,2,2),("${k3}",3,3,3);""" + sql """insert into ${tableName} values + (${k1},${i},1,9), + (${k1},${i},2,8), + (${k1},${i},3,7)""" } } (2..91).each { idx -> checkKeyBounds(idx, 2, true) } - qt_sql "select * from ${tableName} order by k;" + qt_sql "select * from ${tableName} order by k1,k2,k3;" // 2. point lookup on mow table - - + for (int i=1;i<=9;i++) { + explain { + sql """ select * from ${tableName} where k1=${k1} and k2=${i} and k3=1; """ + contains "SHORT-CIRCUIT" + } + qt_sql """ select * from ${tableName} where k1=${k1} and k2=${i} and k3=1; """ + } } }