You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/31 15:39:07 UTC

[doris] 09/20: [Improvement](decimal) do not log fatal when precision is invalid (#16207)

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 bf5417e80a2c874136cd688e77aa21f3d177dfc2
Author: Gabriel <ga...@gmail.com>
AuthorDate: Mon Jan 30 09:54:22 2023 +0800

    [Improvement](decimal) do not log fatal when precision is invalid (#16207)
---
 be/src/vec/data_types/data_type_decimal.cpp | 6 ++++--
 be/src/vec/exprs/vexpr.cpp                  | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/data_types/data_type_decimal.cpp b/be/src/vec/data_types/data_type_decimal.cpp
index aa1da12e4d..5d00e65033 100644
--- a/be/src/vec/data_types/data_type_decimal.cpp
+++ b/be/src/vec/data_types/data_type_decimal.cpp
@@ -163,11 +163,13 @@ T DataTypeDecimal<T>::parse_from_string(const std::string& str) const {
 DataTypePtr create_decimal(UInt64 precision_value, UInt64 scale_value, bool use_v2) {
     if (precision_value < min_decimal_precision() ||
         precision_value > max_decimal_precision<Decimal128>()) {
-        LOG(FATAL) << "Wrong precision " << precision_value;
+        LOG(WARNING) << "Wrong precision " << precision_value;
+        return nullptr;
     }
 
     if (static_cast<UInt64>(scale_value) > precision_value) {
-        LOG(FATAL) << "Negative scales and scales larger than precision are not supported";
+        LOG(WARNING) << "Negative scales and scales larger than precision are not supported";
+        return nullptr;
     }
 
     if (use_v2) {
diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index b1dbe2015f..a91109291d 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -160,6 +160,9 @@ Status VExpr::create_expr(doris::ObjectPool* pool, const doris::TExprNode& texpr
     default:
         return Status::InternalError("Unknown expr node type: {}", texpr_node.node_type);
     }
+    if (!(*expr)->data_type()) {
+        return Status::InvalidArgument("Unknown expr type: {}", texpr_node.node_type);
+    }
     return Status::OK();
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org