Skip to content

Commit

Permalink
add nereids ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xiedeyantu committed Mar 19, 2024
1 parent 23c9dd5 commit 0ff03e2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ suite("test_multi_partition") {


// create one table without datetime partition, but with date string
sql """set enable_fallback_to_original_planner=false"""
sql """
CREATE TABLE IF NOT EXISTS range_date_cast_to_datetime (
id int,
Expand All @@ -486,4 +487,23 @@ suite("test_multi_partition") {
assertTrue(result2[1][1].startsWith("p_"))
sql "drop table range_date_cast_to_datetime"

sql """set enable_fallback_to_original_planner=true """
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 @@ -297,6 +297,7 @@ suite("test_range_partition", "p0") {
)

// create one table without datetime partition, but with date string
sql """set enable_fallback_to_original_planner=false"""
sql """
CREATE TABLE IF NOT EXISTS range_date_cast_to_datetime (
id int,
Expand All @@ -310,4 +311,17 @@ suite("test_range_partition", "p0") {
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"

sql """set enable_fallback_to_original_planner=true"""
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 0ff03e2

Please sign in to comment.