Skip to content

Commit

Permalink
add ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xiedeyantu committed Mar 17, 2024
1 parent 0c5ecdf commit 459fef0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,24 @@ suite("test_multi_partition") {
assertTrue(result2[1][1].startsWith("p_"))
sql "drop table multi_par12"

}
// create one table without datetime partition, but with date string
sql """
CREATE TABLE IF NOT EXISTS range_date_cast_to_datetime (
id int,
name string,
pdate DATETIME )
PARTITION BY RANGE(pdate)(
FROM ("2023-04-16") TO ("2023-04-20") INTERVAL 1 DAY
)
DISTRIBUTED BY HASH(id) BUCKETS 1 properties("replication_num" = "1")
"""
result1 = sql "show tables like 'range_date_cast_to_datetime'"
logger.info("${result1}")
assertEquals(result1.size(), 1)
result2 = sql "show partitions from range_date_cast_to_datetime"
logger.info("${result2}")
assertEquals(result2.size(), 4)
assertTrue(result2[1][1].startsWith("p_"))
sql "drop table range_date_cast_to_datetime"

}
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,18 @@ suite("test_range_partition", "p0") {
"DISTRIBUTED BY RANDOM BUCKETS 13"
)

// create one table without datetime partition, but with date string
sql """
CREATE TABLE IF NOT EXISTS range_date_cast_to_datetime (
id int,
name string,
pdate DATETIME )
PARTITION BY RANGE(pdate)(
PARTITION pd20230418 VALUES less than ("2023-04-20")
)
DISTRIBUTED BY HASH(id) BUCKETS 1 properties("replication_num" = "1")
"""
sql "insert into range_date_cast_to_datetime values (1, 'name', '2023-04-19 08:08:30')"
sql "drop table range_date_cast_to_datetime"

}

0 comments on commit 459fef0

Please sign in to comment.