Skip to content

Commit

Permalink
modify by comment
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei committed Dec 17, 2024
1 parent 5bd5f2a commit 3964e77
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new DayCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new DayFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new HourCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new HourFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new MinuteCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new MinuteFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new MonthCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new MonthFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new SecondCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new SecondFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new YearCeil(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public Expression withConstantArgs(Expression literal) {
case 3:
return new YearFloor(literal, child(1), child(2));
default:
// should not reach
return null;
throw new IllegalStateException("The function " + getName() + " has invalid child number.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ suite("test_add_sub_diff_ceil_floor") {
}
explain {
sql "select * from test_add_sub_diff_ceil_floor_t where years_diff('2021-01-01',month_ceil(hours_sub(dt, 1))) <=2"
contains("partitions=3/5 (p3,p4,p5)")
contains("partitions=4/5 (p1,p3,p4,p5)")
}
// mixed with non-function predicates
explain {
Expand All @@ -293,4 +293,21 @@ suite("test_add_sub_diff_ceil_floor") {
sql """select * from test_add_sub_diff_ceil_floor_t where hours_add(dt, years_diff(dt,'2018-01-01')) <'2018-01-01' """
contains("partitions=5/5 (p1,p2,p3,p4,p5)")
}

// max
sql "drop table if exists max_t"
sql """create table max_t (a int, dt datetime, d date, c varchar(100)) duplicate key(a)
partition by range(dt) (
partition p1 values less than ("2017-01-01"),
partition p2 values less than ("2018-01-01"),
partition p3 values less than ("2019-01-01"),
partition p4 values less than ("2020-01-01"),
partition p5 values less than ("2021-01-01"),
partition p6 values less than MAX
) distributed by hash(a) properties("replication_num"="1");"""
sql """INSERT INTO max_t SELECT number,
date_add('2016-01-01 00:00:00', interval number month),
cast(date_add('2022-01-01 00:00:00', interval number month) as date), cast(number as varchar(65533)) FROM numbers('number'='100');"""
sql "INSERT INTO max_t values(3,null,null,null);"

}

0 comments on commit 3964e77

Please sign in to comment.