Skip to content

Commit

Permalink
fix code style && fix timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
liutang123 committed Jan 16, 2025
1 parent 5e6734f commit d289fd4
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions be/src/vec/runtime/vdatetime_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ bool VecDateTimeValue::from_date_str_base(const char* date_str, int len,
return false;
}
} else {
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
}
Expand All @@ -207,14 +207,14 @@ bool VecDateTimeValue::from_date_str_base(const char* date_str, int len,
if (field_idx == 2 && *ptr == 'T') {
// YYYYMMDDTHHMMDD, skip 'T' and continue
ptr++;
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
if (ptr == end || !isdigit(*ptr)) {
return false;
}
} else if (check_date_punct(*ptr)) {
switch(field_idx) {
switch (field_idx) {
case 0:
case 1:
if (*ptr == '-') {
Expand Down Expand Up @@ -245,6 +245,11 @@ bool VecDateTimeValue::from_date_str_base(const char* date_str, int len,
} else {
return false;
}
case 6:
if (*ptr != '+' && *ptr != '-') {
return false;
}
break;
default:
return false;
}
Expand All @@ -257,7 +262,7 @@ bool VecDateTimeValue::from_date_str_base(const char* date_str, int len,
return false;
}
} else {
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
}
Expand Down Expand Up @@ -2171,7 +2176,7 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int scale
return false;
}
} else {
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
}
Expand All @@ -2180,14 +2185,14 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int scale
if (field_idx == 2 && *ptr == 'T') {
// YYYYMMDDTHHMMDD, skip 'T' and continue
ptr++;
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
if (ptr == end || !isdigit(*ptr)) {
return false;
}
} else if (check_date_punct(*ptr)) {
switch(field_idx) {
switch (field_idx) {
case 0:
case 1:
if (*ptr == '-') {
Expand Down Expand Up @@ -2218,6 +2223,11 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int scale
} else {
return false;
}
case 6:
if (*ptr != '+' && *ptr != '-') {
return false;
}
break;
default:
return false;
}
Expand All @@ -2230,10 +2240,10 @@ bool DateV2Value<T>::from_date_str_base(const char* date_str, int len, int scale
return false;
}
} else {
while(ptr < end && check_space(*ptr)) {
while (ptr < end && check_space(*ptr)) {
ptr++;
}
}
}

// Second part
if (field_idx == 5 && ptr < end) {
Expand Down

0 comments on commit d289fd4

Please sign in to comment.