[fix](delete) fix the error message for valid decimal data for 2.1 (#37710)

## Proposed changes

cherry-pick : #36802

<!--Describe your changes.-->
This commit is contained in:
lw112
2024-07-15 09:54:42 +08:00
committed by GitHub
parent 16de141743
commit b55dd6f644
3 changed files with 32 additions and 2 deletions

View File

@ -546,7 +546,8 @@ bool valid_decimal(const std::string& value_str, const uint32_t precision, const
}
size_t number_length = value_str.size();
if (value_str[0] == '-') {
bool is_negative = value_str[0] == '-';
if (is_negative) {
--number_length;
}
@ -557,7 +558,7 @@ bool valid_decimal(const std::string& value_str, const uint32_t precision, const
integer_len = number_length;
fractional_len = 0;
} else {
integer_len = point_pos;
integer_len = point_pos - (is_negative ? 1 : 0);
fractional_len = number_length - point_pos - 1;
}