Skip to content

Commit

Permalink
add regression
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei committed Dec 19, 2024
1 parent 29e6ca9 commit 8c84c54
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ suite("always_mono_func") {
cast(date_add('2022-01-01 00:00:00', interval number month) as date), cast(number as varchar(65533)) FROM numbers('number'='55');"""
sql "INSERT INTO always_mono_func values(3,null,null,null);"

// format 测试满足格式的裁剪,不满足不裁剪
explain {
sql """select * from always_mono_func where date_format(dt, "yyyyMMdd") <"20190101" """
contains("partitions=3/5 (p1,p2,p3)")
Expand Down Expand Up @@ -112,19 +111,15 @@ suite("always_mono_func") {
}

explain {
sql """ select * from always_mono_func where last_day(dt) > "2019-01-01" """
contains("partitions=3/5 (p3,p4,p5)")
sql """select * from always_mono_func where date_format(dt, "yyyyddMM") <"20190101" """
contains("partitions=5/5 (p1,p2,p3,p4,p5)")
}

explain {
sql """ select * from always_mono_func where to_date(dt) > "2019-01-01" """
contains("partitions=2/5 (p4,p5)")
sql """select * from always_mono_func where date_format(dt, "%Y-%d-%m %T") <"2019-01-01" """
contains("partitions=5/5 (p1,p2,p3,p4,p5)")
}

explain {
sql """ select * from always_mono_func where to_monday(dt) >= "2019-01-01" """
contains("partitions=2/5 (p4,p5)")
}
// year
explain {
sql """ select * from always_mono_func where year(dt) >= 2019 """
Expand All @@ -151,6 +146,10 @@ suite("always_mono_func") {
sql """select * from always_mono_func where to_monday(dt) >='2018-01-01' and to_monday(dt) <'2019-01-01' """
contains("partitions=3/5 (p2,p3,p4)")
}
explain {
sql """ select * from always_mono_func where to_monday(dt) >= "2019-01-01" """
contains("partitions=2/5 (p4,p5)")
}
// to_date
explain {
sql """select * from always_mono_func where to_date(dt) <'2019-02-01' """
Expand All @@ -172,6 +171,10 @@ suite("always_mono_func") {
sql """select * from always_mono_func where to_date(dt) >='2018-01-01' and to_date(dt) <'2019-01-01' """
contains("partitions=2/5 (p2,p3)")
}
explain {
sql """ select * from always_mono_func where to_date(dt) > "2019-01-01" """
contains("partitions=2/5 (p4,p5)")
}
// last_day
explain {
sql """select * from always_mono_func where last_day(dt) <='2019-02-01' """
Expand All @@ -193,6 +196,10 @@ suite("always_mono_func") {
sql """select * from always_mono_func where last_day(dt) >='2018-01-01' and last_day(dt) <'2019-01-01' """
contains("partitions=2/5 (p2,p3)")
}
explain {
sql """ select * from always_mono_func where last_day(dt) > "2019-01-01" """
contains("partitions=3/5 (p3,p4,p5)")
}

explain {
sql """select * from always_mono_func where date_format(to_monday(dt), 'yyyyMMdd') >= "20190101" """
Expand Down

0 comments on commit 8c84c54

Please sign in to comment.