Skip to content

Commit

Permalink
test empty cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zclllyybb committed Sep 11, 2024
1 parent aede9a7 commit b6c1e1a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,18 @@ suite("test_iot_auto_detect") {
sql """ insert into dt values ("2005-01-01"), ("2013-02-02"), ("2022-03-03"); """
sql """ insert overwrite table dt partition(*) values ("2008-01-01"), ("2008-02-02"); """
qt_sql " select * from dt order by k0; "
try {
test {
sql """ insert overwrite table dt partition(*) values ("2023-02-02"), ("3000-12-12"); """
fail()
} catch (Exception e) {
log.info(e.getMessage())
assertTrue(e.getMessage().contains('Insert has filtered data in strict mode') ||
e.getMessage().contains('Cannot found origin partitions in auto detect overwriting'))
}

check { result, exception, startTime, endTime ->
assertTrue(exception.getMessage().contains('Insert has filtered data in strict mode') ||
exception.getMessage().contains('Cannot found origin partitions in auto detect overwriting'))
}
}
// test no rows(no partition hits) overwrite
sql " drop table if exists dt2"
sql " create table dt2 like dt"
sql " insert overwrite table dt2 partition(*) select * from dt2"
sql " insert overwrite table dt partition(*) select * from dt2"
sql " insert overwrite table dt partition(p10, pMAX) select * from dt2"
sql " insert overwrite table dt select * from dt2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ suite("test_auto_partition_behavior") {
result = sql "show partitions from unique_table"
assertEquals(result.size(), 10)
// add partition
try {
test {
sql """ alter table unique_table add partition padd values in ("Xxx") """
fail()
} catch (Exception e) {
assertTrue(e.getMessage().contains("is conflict with current partitionKeys"))
exception "is conflict with current partitionKeys"
}
// drop partition
def partitions = sql "show partitions from unique_table order by PartitionName"
Expand Down Expand Up @@ -94,11 +92,9 @@ suite("test_auto_partition_behavior") {
result = sql "show partitions from dup_table"
assertEquals(result.size(), 10)
// add partition
try {
test {
sql """ alter table dup_table add partition padd values in ("Xxx") """
fail()
} catch (Exception e) {
assertTrue(e.getMessage().contains("is conflict with current partitionKeys"))
exception "is conflict with current partitionKeys"
}
// drop partition
partitions = sql "show partitions from dup_table order by PartitionName"
Expand Down Expand Up @@ -168,11 +164,9 @@ suite("test_auto_partition_behavior") {
);
"""
sql """ insert into rewrite values ("Xxx"); """
try {
test {
sql """ insert overwrite table rewrite partition(p1) values ("") """
fail()
} catch (Exception e) {
assertTrue(e.getMessage().contains("Insert has filtered data in strict mode"))
exception "Insert has filtered data in strict mode"
}
sql """ insert overwrite table rewrite partition(p1) values ("Xxx") """
qt_sql_overwrite """ select * from rewrite """ // Xxx
Expand Down Expand Up @@ -297,6 +291,9 @@ suite("test_auto_partition_behavior") {
part_result = sql " show tablets from test_change "
assertEquals(part_result.size, 52 * replicaNum)



// test not auto partition have expr.
test {
sql """
CREATE TABLE not_auto_expr (
Expand All @@ -310,4 +307,11 @@ suite("test_auto_partition_behavior") {
"""
exception "Non-auto partition table not support partition expr!"
}


// test insert empty
sql "create table if not exists empty_range like test_change"
sql "insert into test_change select * from empty_range"
sql "create table if not exists empty_list like long_value"
sql "insert into long_value select * from empty_list"
}

0 comments on commit b6c1e1a

Please sign in to comment.