Skip to content

Commit

Permalink
add read scenarios case
Browse files Browse the repository at this point in the history
  • Loading branch information
bobhan1 committed Dec 18, 2024
1 parent 878bde7 commit 59d64f4
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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; """
}
}
}

0 comments on commit 59d64f4

Please sign in to comment.