Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguolei committed Nov 22, 2024
1 parent 96371e3 commit e9635b2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions be/src/vec/runtime/vdatetime_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, size_t len, int sc
if (scale >= 0) {
// do normalization
const auto ms_digit_count = ptr - start;
const auto normalizer = int_exp10(std::abs(7 - ms_digit_count));
const auto normalizer = int_exp10(std::abs(7 - (int)ms_digit_count));
temp_val *= cast_set<int32_t>(normalizer);

// check round
Expand All @@ -2097,7 +2097,7 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, size_t len, int sc
}
} else {
// Microsecond
const auto ms_part = ptr - start;
const auto ms_part = cast_set<int32_t>(ptr - start);
temp_val *= cast_set<int32_t>(int_exp10(std::max(0L, 6 - ms_part)));
}
}
Expand Down Expand Up @@ -2437,8 +2437,8 @@ bool DateV2Value<T>::from_date_format_str(const char* format, int format_len, co
}
}
if constexpr (is_datetime) {
microsecond =
int_value * cast_set<int32_t>(int_exp10(6 - min(6, (int)(tmp - val))));
microsecond = cast_set<int32_t>(
int_value * cast_set<int32_t>(int_exp10(6 - min(6, (int)(tmp - val)))));
part_used |= FRAC_PART;
}
val = tmp;
Expand Down Expand Up @@ -2995,7 +2995,7 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value
seconds += 86400L;
days--;
}
unt32_t day_nr = doris::calc_daynr(this->year(), this->month(), 1) + days;
uint32_t day_nr = doris::calc_daynr(this->year(), this->month(), 1) + days;
if (!to_value.get_date_from_daynr(day_nr)) {
return false;
}
Expand All @@ -3013,8 +3013,8 @@ bool DateV2Value<T>::date_add_interval(const TimeInterval& interval, DateV2Value
}
} else if constexpr (unit == QUARTER || unit == MONTH || unit == YEAR_MONTH) {
// This will change month and year information, maybe date.
int64_t months = date_v2_value_.year_ * 12 + date_v2_value_.month_ - 1 +
12 * interval.year + interval.month;
int32_t months = cast_set<int32_t>(date_v2_value_.year_ * 12 + date_v2_value_.month_ - 1 +
12 * interval.year + interval.month);
if (months < 0) {
return false;
}
Expand Down

0 comments on commit e9635b2

Please sign in to comment.