Skip to content

Commit

Permalink
update limit
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangstar333 committed Mar 28, 2024
1 parent 70bd1e8 commit d5d67bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions be/src/vec/functions/function_date_or_datetime_computation.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ struct TimeDiffImpl {

static constexpr auto name = "timediff";
static constexpr auto is_nullable = false;
static constexpr int64_t limit_value = 3020399000000;
static inline ReturnType::FieldType execute(const ArgType1& t0, const ArgType2& t1,
bool& is_null) {
const auto& ts0 = reinterpret_cast<const DateValueType1&>(t0);
Expand All @@ -298,12 +299,15 @@ struct TimeDiffImpl {
// refer to https://dev.mysql.com/doc/refman/5.7/en/time.html
// the time type value between '-838:59:59' and '838:59:59', so the return value should limited
int64_t diff_m = ts0.microsecond_diff(ts1);
if (diff_m > (int64_t)3020399 * 1000 * 1000) {
diff_m = (int64_t)3020399 * 1000 * 1000;
if (diff_m > limit_value) {
return (double)limit_value;
} else if (diff_m < -1 * limit_value) {
return (double)(-1 * limit_value);
} else {
return (double)diff_m;
}
return (double)diff_m;
} else {
return (1000 * 1000) * ts0.second_diff(ts1);
return (double)((1000 * 1000) * ts0.second_diff(ts1));
}
}
static DataTypes get_variadic_argument_types() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1839,10 +1839,10 @@ public void initFuzzyModeVariables() {
if (Config.pull_request_id > 0) {
if (Config.pull_request_id % 2 == 1) {
this.batchSize = 4064;
// this.enableFoldConstantByBe = true;
this.enableFoldConstantByBe = true;
} else {
this.batchSize = 50;
// this.enableFoldConstantByBe = false;
this.enableFoldConstantByBe = false;
}
}
}
Expand Down

0 comments on commit d5d67bb

Please sign in to comment.