diff --git a/be/src/vec/common/string_ref.h b/be/src/vec/common/string_ref.h index ebc4dcc88d..8f83d072ad 100644 --- a/be/src/vec/common/string_ref.h +++ b/be/src/vec/common/string_ref.h @@ -55,6 +55,9 @@ struct StringRef { std::string to_string() const { return std::string(data, size); } std::string_view to_string_view() const { return std::string_view(data, size); } + // this is just for show, eg. print data to error log, to avoid print large string. + std::string to_prefix(size_t length) const { return std::string(data, std::min(length, size)); } + explicit operator std::string() const { return to_string(); } StringVal to_string_val() { diff --git a/be/src/vec/sink/vtablet_sink.cpp b/be/src/vec/sink/vtablet_sink.cpp index 0ce0cf7663..d1a62f4ae7 100644 --- a/be/src/vec/sink/vtablet_sink.cpp +++ b/be/src/vec/sink/vtablet_sink.cpp @@ -216,7 +216,7 @@ Status VOlapTableSink::_validate_data(RuntimeState* state, vectorized::Block* bl fmt::format_to(error_msg, "{}", "the length of input is too long than schema. "); fmt::format_to(error_msg, "column_name: {}; ", desc->col_name()); - fmt::format_to(error_msg, "input str: [{}] ", str_val.to_string()); + fmt::format_to(error_msg, "input str: [{}] ", str_val.to_prefix(10)); fmt::format_to(error_msg, "schema length: {}; ", desc->type().len); fmt::format_to(error_msg, "actual length: {}; ", str_val.size); } else if (str_val.size > MAX_SIZE_OF_VEC_STRING) { @@ -224,9 +224,9 @@ Status VOlapTableSink::_validate_data(RuntimeState* state, vectorized::Block* bl error_msg, "{}", "the length of input string is too long than vec schema. "); fmt::format_to(error_msg, "column_name: {}; ", desc->col_name()); - fmt::format_to(error_msg, "input str: [{}] ", str_val.to_string()); - fmt::format_to(error_msg, "schema length: {}; ", - MAX_SIZE_OF_VEC_STRING); + fmt::format_to(error_msg, "input str: [{}] ", str_val.to_prefix(10)); + fmt::format_to(error_msg, "schema length: {}; ", desc->type().len); + fmt::format_to(error_msg, "limit length: {}; ", MAX_SIZE_OF_VEC_STRING); fmt::format_to(error_msg, "actual length: {}; ", str_val.size); } diff --git a/docs/.vuepress/sidebar/en.js b/docs/.vuepress/sidebar/en.js index 628022ef38..8cca1c5b84 100644 --- a/docs/.vuepress/sidebar/en.js +++ b/docs/.vuepress/sidebar/en.js @@ -367,7 +367,6 @@ module.exports = [ "ascii", "bit_length", "char_length", - "coalesce", "concat", "concat_ws", "ends_with", diff --git a/docs/.vuepress/sidebar/zh-CN.js b/docs/.vuepress/sidebar/zh-CN.js index 886abe7808..3fd8f69003 100644 --- a/docs/.vuepress/sidebar/zh-CN.js +++ b/docs/.vuepress/sidebar/zh-CN.js @@ -369,7 +369,6 @@ module.exports = [ "ascii", "bit_length", "char_length", - "coalesce", "concat", "concat_ws", "ends_with", diff --git a/docs/en/sql-reference/sql-functions/string-functions/coalesce.md b/docs/en/sql-reference/sql-functions/string-functions/coalesce.md deleted file mode 100644 index 23fef73f49..0000000000 --- a/docs/en/sql-reference/sql-functions/string-functions/coalesce.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -{ - "title": "coalesce", - "language": "en" -} ---- - - - -# coalesce -## Description -### Syntax - -`VARCHAR coalesce(VARCHAR, ...)` -`...` -`INT coalesce(INT, ...)` - -` coalesce ` function will return the first not null value. If it's all value is null, return null - -## example - -``` -MySQL> select coalesce(1,null,2); -+----------------------+ -| coalesce(1, NULL, 2) | -+----------------------+ -| 1 | -+----------------------+ - -MySQL> select coalesce(null,"asd",1); -+--------------------------+ -| coalesce(NULL, 'asd', 1) | -+--------------------------+ -| asd | -+--------------------------+ - -MySQL> select coalesce(null,null,null); -+----------------------------+ -| coalesce(NULL, NULL, NULL) | -+----------------------------+ -| NULL | -+----------------------------+ -``` -## keyword -coalesce diff --git a/docs/zh-CN/sql-reference/sql-functions/conditional-functions/coalesce.md b/docs/zh-CN/sql-reference/sql-functions/conditional-functions/coalesce.md index ebca147a3a..5e55515f9a 100644 --- a/docs/zh-CN/sql-reference/sql-functions/conditional-functions/coalesce.md +++ b/docs/zh-CN/sql-reference/sql-functions/conditional-functions/coalesce.md @@ -30,7 +30,6 @@ under the License. `coalesce(expr1, expr2, ...., expr_n))` - 返回参数中的第一个非空表达式(从左向右) ## example @@ -44,4 +43,5 @@ mysql> select coalesce(NULL, '1111', '0000'); +--------------------------------+ ``` ## keyword -COALESCE + + COALESCE diff --git a/docs/zh-CN/sql-reference/sql-functions/string-functions/coalesce.md b/docs/zh-CN/sql-reference/sql-functions/string-functions/coalesce.md deleted file mode 100644 index 0ea6c2a22e..0000000000 --- a/docs/zh-CN/sql-reference/sql-functions/string-functions/coalesce.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -{ - "title": "coalesce", - "language": "zh-CN" -} ---- - - - -# coalesce -## description -### Syntax - -`VARCHAR coalesce(VARCHAR, ...)` -`...` -`INT coalesce(INT, ...)` - -`coalesce`函数会返回第一个非NULL的值,若全部为NULL,则返回NULL - -## example - -``` -MySQL> select coalesce(1,null,2); -+----------------------+ -| coalesce(1, NULL, 2) | -+----------------------+ -| 1 | -+----------------------+ - -MySQL> select coalesce(null,"asd",1); -+--------------------------+ -| coalesce(NULL, 'asd', 1) | -+--------------------------+ -| asd | -+--------------------------+ - -MySQL> select coalesce(null,null,null); -+----------------------------+ -| coalesce(NULL, NULL, NULL) | -+----------------------------+ -| NULL | -+----------------------------+ - -``` -## keyword -coalesce diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java index 6a5c18de9e..743fb219dd 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java @@ -190,7 +190,7 @@ public class CreateFunctionStmt extends DdlStmt { try { computeObjectChecksum(); } catch (IOException | NoSuchAlgorithmException e) { - throw new AnalysisException("cannot to compute object's checksum"); + throw new AnalysisException("cannot to compute object's checksum. err: " + e.getMessage()); } String md5sum = properties.get(MD5_CHECKSUM); if (md5sum != null && !md5sum.equalsIgnoreCase(checksum)) {