This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit a6918535c1090746212748c8512167928a0152b7 Author: Gabriel <[email protected]> AuthorDate: Mon Jul 3 10:55:27 2023 +0800 [decimalv2](compatibility) add config to allow invalid decimalv2 literal (#21327) --- be/src/common/config.h | 3 +++ be/src/runtime/decimalv2_value.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/be/src/common/config.h b/be/src/common/config.h index 6787fba585..3aab83398f 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -921,6 +921,9 @@ CONF_mBool(enable_stack_trace, "true"); // enable shrink memory, default is false CONF_Bool(enable_shrink_memory, "false"); +// Allow invalid decimalv2 literal for compatible with old version. Recommend set it false strongly. +CONF_mBool(allow_invalid_decimalv2_literal, "false"); + #ifdef BE_TEST // test s3 CONF_String(test_s3_resource, "resource"); diff --git a/be/src/runtime/decimalv2_value.cpp b/be/src/runtime/decimalv2_value.cpp index a21bc5a1d1..cffa7f59c8 100644 --- a/be/src/runtime/decimalv2_value.cpp +++ b/be/src/runtime/decimalv2_value.cpp @@ -353,7 +353,9 @@ int DecimalV2Value::parse_from_str(const char* decimal_str, int32_t length) { _value = StringParser::string_to_decimal<__int128>(decimal_str, length, PRECISION, SCALE, &result); - if (result != StringParser::PARSE_SUCCESS) { + if (!config::allow_invalid_decimalv2_literal && result != StringParser::PARSE_SUCCESS) { + error = E_DEC_BAD_NUM; + } else if (config::allow_invalid_decimalv2_literal && result == StringParser::PARSE_FAILURE) { error = E_DEC_BAD_NUM; } return error; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
