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
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new 80d4086015 [Bug](decimal) fix wrong key ranges (#18549)
80d4086015 is described below
commit 80d40860152b3aaf07a0fdabf9f8564c8ee706f0
Author: Gabriel <[email protected]>
AuthorDate: Tue Apr 11 23:23:35 2023 +0800
[Bug](decimal) fix wrong key ranges (#18549)
---
be/src/util/string_parser.hpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/be/src/util/string_parser.hpp b/be/src/util/string_parser.hpp
index 4d203a43d6..4fb0449cfb 100644
--- a/be/src/util/string_parser.hpp
+++ b/be/src/util/string_parser.hpp
@@ -32,6 +32,7 @@
#include "common/compiler_util.h"
#include "common/status.h"
#include "runtime/primitive_type.h"
+#include "vec/data_types/data_type_decimal.h"
namespace doris {
@@ -617,6 +618,15 @@ inline T StringParser::string_to_decimal(const char* s,
int len, int type_precis
DCHECK(value >= 0); // For some reason //DCHECK_GE doesn't work
with __int128.
++precision;
scale += found_dot;
+ if (precision > type_precision) {
+ if constexpr (std::is_same_v<int32_t, T>) {
+ value =
vectorized::max_decimal_value<vectorized::Decimal32>();
+ } else if constexpr (std::is_same_v<int64_t, T>) {
+ value =
vectorized::max_decimal_value<vectorized::Decimal64>();
+ } else {
+ value =
vectorized::max_decimal_value<vectorized::Decimal128>();
+ }
+ }
} else if (c == '.' && LIKELY(!found_dot)) {
found_dot = 1;
} else if ((c == 'e' || c == 'E') && LIKELY(!found_exponent)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]