You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/04/12 06:16:37 UTC
[doris] branch master updated: [Bug](date) fix regression test test_date_function (#18564)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 34c946bb99 [Bug](date) fix regression test test_date_function (#18564)
34c946bb99 is described below
commit 34c946bb99c4d673f9b582f0a38eea50126eb4bb
Author: Gabriel <ga...@gmail.com>
AuthorDate: Wed Apr 12 14:16:30 2023 +0800
[Bug](date) fix regression test test_date_function (#18564)
---
be/src/vec/runtime/vdatetime_value.cpp | 17 +++++++++++------
be/src/vec/runtime/vdatetime_value.h | 2 +-
regression-test/pipeline/p0/conf/regression-conf.groovy | 2 +-
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/be/src/vec/runtime/vdatetime_value.cpp b/be/src/vec/runtime/vdatetime_value.cpp
index 16ee2b5664..148c67f95a 100644
--- a/be/src/vec/runtime/vdatetime_value.cpp
+++ b/be/src/vec/runtime/vdatetime_value.cpp
@@ -1795,28 +1795,31 @@ bool DateV2Value<T>::is_invalid(uint32_t year, uint32_t month, uint32_t day, uin
}
template <typename T>
-void DateV2Value<T>::format_datetime(uint32_t* date_val) const {
+void DateV2Value<T>::format_datetime(uint32_t* date_val, bool* carry_bits) const {
// ms
DCHECK(date_val[6] < 1000000L);
// hour, minute, second
for (size_t i = 5; i > 2; i--) {
- if (date_val[i] == MAX_TIME_PART_VALUE[i - 3] + 1) {
+ if (date_val[i] == MAX_TIME_PART_VALUE[i - 3] + 1 && carry_bits[i + 1]) {
date_val[i] = 0;
date_val[i - 1] += 1;
+ carry_bits[i] = true;
}
}
// day
if (date_val[1] == 2 && doris::is_leap(date_val[0])) {
- if (date_val[2] == 30) {
+ if (date_val[2] == 30 && carry_bits[3]) {
date_val[2] = 1;
date_val[1] += 1;
+ carry_bits[2] = true;
}
- } else if (date_val[2] == s_days_in_month[date_val[1]] + 1) {
+ } else if (date_val[2] == s_days_in_month[date_val[1]] + 1 && carry_bits[3]) {
date_val[2] = 1;
date_val[1] += 1;
+ carry_bits[2] = true;
}
// month
- if (date_val[1] == 13) {
+ if (date_val[1] == 13 && carry_bits[2]) {
date_val[1] = 1;
date_val[0] += 1;
}
@@ -1833,6 +1836,7 @@ bool DateV2Value<T>::from_date_str(const char* date_str, int len, int scale) {
const static int allow_space_mask = 4 | 64;
uint32_t date_val[MAX_DATE_PARTS] = {0};
int32_t date_len[MAX_DATE_PARTS] = {0};
+ bool carry_bits[MAX_DATE_PARTS] = {false};
// Skip space character
while (ptr < end && isspace(*ptr)) {
@@ -1891,6 +1895,7 @@ bool DateV2Value<T>::from_date_str(const char* date_str, int len, int scale) {
if (temp_val == 1000000L) {
temp_val = 0;
date_val[field_idx - 1] += 1;
+ carry_bits[field_idx] = true;
}
}
}
@@ -1955,7 +1960,7 @@ bool DateV2Value<T>::from_date_str(const char* date_str, int len, int scale) {
}
if (num_field < 3) return false;
- format_datetime(date_val);
+ format_datetime(date_val, carry_bits);
return check_range_and_set_time(date_val[0], date_val[1], date_val[2], date_val[3], date_val[4],
date_val[5], date_val[6]);
}
diff --git a/be/src/vec/runtime/vdatetime_value.h b/be/src/vec/runtime/vdatetime_value.h
index 622a4d9350..09c1d4dbe6 100644
--- a/be/src/vec/runtime/vdatetime_value.h
+++ b/be/src/vec/runtime/vdatetime_value.h
@@ -1122,7 +1122,7 @@ public:
static constexpr int MAX_DATE_PARTS = 7;
static constexpr uint32_t MAX_TIME_PART_VALUE[3] = {23, 59, 59};
- void format_datetime(uint32_t* date_val) const;
+ void format_datetime(uint32_t* date_v, bool* carry_bits) const;
private:
static uint8_t calc_week(const uint32_t& day_nr, const uint16_t& year, const uint8_t& month,
diff --git a/regression-test/pipeline/p0/conf/regression-conf.groovy b/regression-test/pipeline/p0/conf/regression-conf.groovy
index 5f3112f86e..2beff2390b 100644
--- a/regression-test/pipeline/p0/conf/regression-conf.groovy
+++ b/regression-test/pipeline/p0/conf/regression-conf.groovy
@@ -48,7 +48,7 @@ testDirectories = ""
// this groups will not be executed
excludeGroups = ""
// this suites will not be executed
-excludeSuites = "test_date_function,test_broker_load"
+excludeSuites = "test_broker_load"
// this directories will not be executed
excludeDirectories = ""
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org