From ad080c691fbeac5ba9ef42268bd4c0298e150681 Mon Sep 17 00:00:00 2001 From: zclllyybb Date: Fri, 28 Jul 2023 13:15:25 +0800 Subject: [PATCH] [chore](log)Move non-user-friendly error message to be.WARNING (#22315) Move non-user-friendly error message to be.WARNING --- be/src/io/fs/benchmark/benchmark_factory.hpp | 1 - be/src/olap/delete_handler.cpp | 2 +- be/src/olap/reader.cpp | 3 --- .../olap/rowset/segment_v2/inverted_index_reader.cpp | 1 - be/src/olap/utils.cpp | 2 +- be/src/vec/exprs/vexpr.cpp | 10 ++++++++-- .../main/java/org/apache/doris/catalog/ScalarType.java | 6 ++++-- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/be/src/io/fs/benchmark/benchmark_factory.hpp b/be/src/io/fs/benchmark/benchmark_factory.hpp index e5c9991dcf..df08aaeca9 100644 --- a/be/src/io/fs/benchmark/benchmark_factory.hpp +++ b/be/src/io/fs/benchmark/benchmark_factory.hpp @@ -98,7 +98,6 @@ public: Status init_env() { std::string conffile = std::string(getenv("DORIS_HOME")) + "/conf/be.conf"; if (!doris::config::init(conffile.c_str(), true, true, true)) { - fprintf(stderr, "error read config file. \n"); return Status::Error("error read config file."); } doris::CpuInfo::init(); diff --git a/be/src/olap/delete_handler.cpp b/be/src/olap/delete_handler.cpp index 9b615e9db5..6c1f6c2930 100644 --- a/be/src/olap/delete_handler.cpp +++ b/be/src/olap/delete_handler.cpp @@ -61,7 +61,7 @@ Status DeleteHandler::generate_delete_predicate(const TabletSchema& schema, // Check whether the delete condition meets the requirements for (const TCondition& condition : conditions) { if (check_condition_valid(schema, condition) != Status::OK()) { - LOG(WARNING) << "invalid condition. condition=" << ThriftDebugString(condition); + // Error will print log, no need to do it manually. return Status::Error("invalid condition. condition={}", ThriftDebugString(condition)); } diff --git a/be/src/olap/reader.cpp b/be/src/olap/reader.cpp index 1a5516f273..15703b97e5 100644 --- a/be/src/olap/reader.cpp +++ b/be/src/olap/reader.cpp @@ -445,9 +445,6 @@ Status TabletReader::_init_orderby_keys_param(const ReaderParams& read_params) { } } if (read_params.read_orderby_key_num_prefix_columns != _orderby_key_columns.size()) { - LOG(WARNING) << "read_orderby_key_num_prefix_columns != _orderby_key_columns.size " - << read_params.read_orderby_key_num_prefix_columns << " vs. " - << _orderby_key_columns.size(); return Status::Error( "read_orderby_key_num_prefix_columns != _orderby_key_columns.size, " "read_params.read_orderby_key_num_prefix_columns={}, " diff --git a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp index 8a9a08df0a..8c95cfbd38 100644 --- a/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp +++ b/be/src/olap/rowset/segment_v2/inverted_index_reader.cpp @@ -618,7 +618,6 @@ Status BkdIndexReader::try_query(OlapReaderStatistics* stats, const std::string& } *count = r->estimate_point_count(visitor.get()); } catch (const CLuceneError& e) { - LOG(WARNING) << "BKD Query CLuceneError Occurred, error msg: " << e.what(); return Status::Error( "BKD Query CLuceneError Occurred, error msg: {}", e.what()); } diff --git a/be/src/olap/utils.cpp b/be/src/olap/utils.cpp index 98f3ac3807..52f9fa8bb8 100644 --- a/be/src/olap/utils.cpp +++ b/be/src/olap/utils.cpp @@ -411,7 +411,7 @@ Status gen_timestamp_string(std::string* out_string) { if (localtime_r(&now, &local_tm) == nullptr) { return Status::Error("fail to localtime_r time. time={}", now); } - char time_suffix[16] = {0}; // Example: 20150706111404, 长度是15个字符 + char time_suffix[16] = {0}; // Example: 20150706111404's length is 15 if (strftime(time_suffix, sizeof(time_suffix), "%Y%m%d%H%M%S", &local_tm) == 0) { return Status::Error("fail to strftime time. time={}", now); } diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp index 69e79e8ced..75a21addb0 100644 --- a/be/src/vec/exprs/vexpr.cpp +++ b/be/src/vec/exprs/vexpr.cpp @@ -28,6 +28,7 @@ #include "common/config.h" #include "common/exception.h" #include "common/object_pool.h" +#include "common/status.h" #include "vec/columns/column_vector.h" #include "vec/columns/columns_number.h" #include "vec/data_types/data_type_factory.hpp" @@ -212,8 +213,13 @@ Status VExpr::create_expr(const TExprNode& expr_node, VExprSPtr& expr) { return Status::InternalError("Unknown expr node type: {}", expr_node.node_type); } } catch (const Exception& e) { - return Status::InternalError("create expr failed, TExprNode={}, reason={}", - apache::thrift::ThriftDebugString(expr_node), e.what()); + if (e.code() == ErrorCode::INTERNAL_ERROR) { + return Status::InternalError("Create Expr failed because {}\nTExprNode={}", e.what(), + apache::thrift::ThriftDebugString(expr_node)); + } + return Status::Error(e.code(), "Create Expr failed because {}", e.what()); + LOG(WARNING) << "create expr failed, TExprNode={}, reason={}" + << apache::thrift::ThriftDebugString(expr_node) << e.what(); } if (!expr->data_type()) { return Status::InvalidArgument("Unknown expr type: {}", expr_node.node_type); diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java b/fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java index 41cd59d474..00c788f363 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java +++ b/fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java @@ -684,13 +684,15 @@ public class ScalarType extends Type { case DECIMAL64: case DECIMAL128: case DATETIMEV2: { - Preconditions.checkArgument(precision >= scale); + Preconditions.checkArgument(precision >= scale, + String.format("given precision %d is out of scale bound %d", precision, scale)); scalarType.setScale(scale); scalarType.setPrecision(precision); break; } case TIMEV2: { - Preconditions.checkArgument(precision >= scale); + Preconditions.checkArgument(precision >= scale, + String.format("given precision %d is out of scale bound %d", precision, scale)); scalarType.setScale(scale); scalarType.setPrecision(precision); break;