diff --git a/regression-test/suites/partition_p0/multi_partition/test_multi_partition.groovy b/regression-test/suites/partition_p0/multi_partition/test_multi_partition.groovy index 78f9359ae44fc1b..221a520eec70332 100644 --- a/regression-test/suites/partition_p0/multi_partition/test_multi_partition.groovy +++ b/regression-test/suites/partition_p0/multi_partition/test_multi_partition.groovy @@ -465,4 +465,24 @@ suite("test_multi_partition") { assertTrue(result2[1][1].startsWith("p_")) sql "drop table multi_par12" -} \ No newline at end of file + // 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" + +} diff --git a/regression-test/suites/partition_p0/multi_partition/test_range_partition.groovy b/regression-test/suites/partition_p0/multi_partition/test_range_partition.groovy index 64f5deff4a8aea1..61a24054e824f40 100644 --- a/regression-test/suites/partition_p0/multi_partition/test_range_partition.groovy +++ b/regression-test/suites/partition_p0/multi_partition/test_range_partition.groovy @@ -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" + }