This is an automated email from the ASF dual-hosted git repository. lihaopeng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 8526a720d88 [Refactor](doc) Add debug functions in dev branch (#922) 8526a720d88 is described below commit 8526a720d887db47f07d9a61848fa07c2fea2e17 Author: zclllhhjj <zhaochan...@selectdb.com> AuthorDate: Wed Jul 31 21:13:15 2024 +0800 [Refactor](doc) Add debug functions in dev branch (#922) debug functions should only appear in dev docs. so no need add to others. there's no code related. --- .../sleep.md => debug-functions/ignore.md} | 39 +++++++++----- .../sql-functions/debug-functions/non-nullable.md | 60 ++++++++++++++++++++++ .../sleep.md => debug-functions/nullable.md} | 36 ++++++++----- .../{string-functions => debug-functions}/sleep.md | 9 ++-- .../docusaurus-plugin-content-docs/current.json | 4 ++ .../sleep.md => debug-functions/ignore.md} | 37 ++++++++----- .../sql-functions/debug-functions/non-nullable.md | 60 ++++++++++++++++++++++ .../sleep.md => debug-functions/nullable.md} | 34 +++++++----- .../{string-functions => debug-functions}/sleep.md | 7 ++- sidebars.json | 11 +++- 10 files changed, 233 insertions(+), 64 deletions(-) diff --git a/docs/sql-manual/sql-functions/string-functions/sleep.md b/docs/sql-manual/sql-functions/debug-functions/ignore.md similarity index 51% copy from docs/sql-manual/sql-functions/string-functions/sleep.md copy to docs/sql-manual/sql-functions/debug-functions/ignore.md index 4aa6b16beb8..ee86d5d4061 100644 --- a/docs/sql-manual/sql-functions/string-functions/sleep.md +++ b/docs/sql-manual/sql-functions/debug-functions/ignore.md @@ -1,6 +1,6 @@ --- { - "title": "SLEEP", + "title": "IGNORE", "language": "en" } --- @@ -24,25 +24,36 @@ specific language governing permissions and limitations under the License. --> -## sleep -### Description +## ignore +### description + +:::tip +For developer debugging only, do not call this function manually in the production environment. +::: + #### Syntax -`BOOLEAN sleep(INT num)` +`BOOLEAN ignore(T expr...)` -Make the thread sleep for num seconds. +Returns `false` for any input. ### example +```sql +mysql> select m1, ignore(m1,m2,m1+m2,1) from t_nullable; ++------+----------------------------------------------------------------------+ +| m1 | ignore(CAST(`m1` AS BIGINT), CAST(`m2` AS BIGINT), (`m1` + `m2`), 1) | ++------+----------------------------------------------------------------------+ +| 1 | 0 | ++------+----------------------------------------------------------------------+ + +mysql> select ignore(); ++----------+ +| ignore() | ++----------+ +| 0 | ++----------+ ``` -mysql> select sleep(10); -+-----------+ -| sleep(10) | -+-----------+ -| 1 | -+-----------+ -1 row in set (10.01 sec) -``` ### keywords - sleep + ignore \ No newline at end of file diff --git a/docs/sql-manual/sql-functions/debug-functions/non-nullable.md b/docs/sql-manual/sql-functions/debug-functions/non-nullable.md new file mode 100644 index 00000000000..e3adb890d30 --- /dev/null +++ b/docs/sql-manual/sql-functions/debug-functions/non-nullable.md @@ -0,0 +1,60 @@ +--- +{ + "title": "NON_NULLABLE", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## non_nullable +### description + +:::tip +For developer debugging only, do not call this function manually in the production environment. +::: + +#### Syntax + +`T non_nullable(T expr)` + +Raise an error if `expr` is of not nullable, or is of nullable and contains a `NULL` value. Otherwise, returns the non-nullable data column of the input column. + +### example + +```sql +mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1; ++------+------------------+ +| k1 | non_nullable(k1) | ++------+------------------+ +| 1 | 1 | +| 2 | 2 | +| 3 | 3 | +| 4 | 4 | ++------+------------------+ + +mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1; +ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]There's NULL value in column Nullable(Int32) which is illegal for non_nullable +mysql> select non_nullable(1); +ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]Try to use originally non-nullable column Int8 in nullable's non-nullable convertion. +``` + +### keywords + non_nullable \ No newline at end of file diff --git a/docs/sql-manual/sql-functions/string-functions/sleep.md b/docs/sql-manual/sql-functions/debug-functions/nullable.md similarity index 54% copy from docs/sql-manual/sql-functions/string-functions/sleep.md copy to docs/sql-manual/sql-functions/debug-functions/nullable.md index 4aa6b16beb8..12248469963 100644 --- a/docs/sql-manual/sql-functions/string-functions/sleep.md +++ b/docs/sql-manual/sql-functions/debug-functions/nullable.md @@ -1,6 +1,6 @@ --- { - "title": "SLEEP", + "title": "NULLABLE", "language": "en" } --- @@ -24,25 +24,33 @@ specific language governing permissions and limitations under the License. --> -## sleep -### Description +## nullable +### description + +:::tip +For developer debugging only, do not call this function manually in the production environment. +::: + #### Syntax -`BOOLEAN sleep(INT num)` +`T nullable(T expr)` -Make the thread sleep for num seconds. +Converts `expr` to nullable, or to itself if `expr` is already nullable. ### example +```sql +mysql> select k1, nullable(k1), nullable(1) from test_nullable_functions order by k1; ++------+--------------+-------------+ +| k1 | nullable(k1) | nullable(1) | ++------+--------------+-------------+ +| NULL | NULL | 1 | +| 1 | 1 | 1 | +| 2 | 2 | 1 | +| 3 | 3 | 1 | +| 4 | 4 | 1 | ++------+--------------+-------------+ ``` -mysql> select sleep(10); -+-----------+ -| sleep(10) | -+-----------+ -| 1 | -+-----------+ -1 row in set (10.01 sec) -``` ### keywords - sleep + nullable \ No newline at end of file diff --git a/docs/sql-manual/sql-functions/string-functions/sleep.md b/docs/sql-manual/sql-functions/debug-functions/sleep.md similarity index 92% rename from docs/sql-manual/sql-functions/string-functions/sleep.md rename to docs/sql-manual/sql-functions/debug-functions/sleep.md index 4aa6b16beb8..4875bb9190d 100644 --- a/docs/sql-manual/sql-functions/string-functions/sleep.md +++ b/docs/sql-manual/sql-functions/debug-functions/sleep.md @@ -25,24 +25,23 @@ under the License. --> ## sleep -### Description +### description #### Syntax `BOOLEAN sleep(INT num)` -Make the thread sleep for num seconds. +Sleeps the current session for `num` second(s)。 ### example -``` +```sql mysql> select sleep(10); +-----------+ | sleep(10) | +-----------+ | 1 | +-----------+ -1 row in set (10.01 sec) - ``` + ### keywords sleep diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json index d5d4f6ed592..6aabb44b56b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json @@ -295,6 +295,10 @@ "message": "分析(窗口)函数", "description": "The label for category Analytic(Window) Functions in sidebar docs" }, + "sidebar.docs.category.Debug Functions": { + "message": "调试函数", + "description": "The label for category Debug Functions in sidebar docs" + }, "sidebar.docs.category.Account Management": { "message": "账户管理", "description": "The label for category Account Management in sidebar docs" diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/ignore.md similarity index 53% copy from i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/ignore.md index 1e277869756..3952559aedd 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/ignore.md @@ -1,6 +1,6 @@ --- { - "title": "SLEEP", + "title": "IGNORE", "language": "zh-CN" } --- @@ -24,25 +24,36 @@ specific language governing permissions and limitations under the License. --> -## sleep +## ignore ### description + +:::tip +仅供开发者调试用,请勿在生产环境手动调用该函数。 +::: + #### Syntax -`BOOLEAN sleep(INT num)` +`BOOLEAN ignore(T expr...)` -使该线程休眠num秒。 +对于任意输入,返回 `false`。 ### example +```sql +mysql> select m1, ignore(m1,m2,m1+m2,1) from t_nullable; ++------+----------------------------------------------------------------------+ +| m1 | ignore(CAST(`m1` AS BIGINT), CAST(`m2` AS BIGINT), (`m1` + `m2`), 1) | ++------+----------------------------------------------------------------------+ +| 1 | 0 | ++------+----------------------------------------------------------------------+ + +mysql> select ignore(); ++----------+ +| ignore() | ++----------+ +| 0 | ++----------+ ``` -mysql> select sleep(10); -+-----------+ -| sleep(10) | -+-----------+ -| 1 | -+-----------+ -1 row in set (10.01 sec) -``` ### keywords - sleep + ignore \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/non-nullable.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/non-nullable.md new file mode 100644 index 00000000000..1bd82e69a65 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/non-nullable.md @@ -0,0 +1,60 @@ +--- +{ + "title": "NON_NULLABLE", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## non_nullable +### description + +:::tip +仅供开发者调试用,请勿在生产环境手动调用该函数。 +::: + +#### Syntax + +`T non_nullable(T expr)` + +如果 `expr` 为非 nullable 类型,或为 nullable 类型且其中包含 `NULL` 值,则报错。否则返回该列的非 nullable 属性数据列。 + +### example + +```sql +mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1; ++------+------------------+ +| k1 | non_nullable(k1) | ++------+------------------+ +| 1 | 1 | +| 2 | 2 | +| 3 | 3 | +| 4 | 4 | ++------+------------------+ + +mysql> select k1, non_nullable(k1) from test_nullable_functions order by k1; +ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]There's NULL value in column Nullable(Int32) which is illegal for non_nullable +mysql> select non_nullable(1); +ERROR 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]Try to use originally non-nullable column Int8 in nullable's non-nullable convertion. +``` + +### keywords + non_nullable \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/nullable.md similarity index 55% copy from i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/nullable.md index 1e277869756..393cf6a12f4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/nullable.md @@ -1,6 +1,6 @@ --- { - "title": "SLEEP", + "title": "NULLABLE", "language": "zh-CN" } --- @@ -24,25 +24,33 @@ specific language governing permissions and limitations under the License. --> -## sleep +## nullable ### description + +:::tip +仅供开发者调试用,请勿在生产环境手动调用该函数。 +::: + #### Syntax -`BOOLEAN sleep(INT num)` +`T nullable(T expr)` -使该线程休眠num秒。 +转换 `expr` 为 nullable 属性,若 `expr` 已经是 nullable 的,则为其本身。 ### example +```sql +mysql> select k1, nullable(k1), nullable(1) from test_nullable_functions order by k1; ++------+--------------+-------------+ +| k1 | nullable(k1) | nullable(1) | ++------+--------------+-------------+ +| NULL | NULL | 1 | +| 1 | 1 | 1 | +| 2 | 2 | 1 | +| 3 | 3 | 1 | +| 4 | 4 | 1 | ++------+--------------+-------------+ ``` -mysql> select sleep(10); -+-----------+ -| sleep(10) | -+-----------+ -| 1 | -+-----------+ -1 row in set (10.01 sec) -``` ### keywords - sleep + nullable \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/sleep.md similarity index 94% rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/sleep.md index 1e277869756..36ab189806a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/sleep.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/debug-functions/sleep.md @@ -30,19 +30,18 @@ under the License. `BOOLEAN sleep(INT num)` -使该线程休眠num秒。 +使当前会话休眠 `num` 秒。 ### example -``` +```sql mysql> select sleep(10); +-----------+ | sleep(10) | +-----------+ | 1 | +-----------+ -1 row in set (10.01 sec) - ``` + ### keywords sleep diff --git a/sidebars.json b/sidebars.json index 8103dd5aea8..f953c428298 100644 --- a/sidebars.json +++ b/sidebars.json @@ -819,7 +819,6 @@ "sql-manual/sql-functions/string-functions/extract-url-parameter", "sql-manual/sql-functions/string-functions/uuid", "sql-manual/sql-functions/string-functions/space", - "sql-manual/sql-functions/string-functions/sleep", "sql-manual/sql-functions/string-functions/esquery", "sql-manual/sql-functions/string-functions/random_bytes", { @@ -1188,6 +1187,16 @@ "sql-manual/sql-functions/distance-functions/l2-distance" ] }, + { + "type": "category", + "label": "Debug Functions", + "items": [ + "sql-manual/sql-functions/debug-functions/ignore", + "sql-manual/sql-functions/debug-functions/non-nullable", + "sql-manual/sql-functions/debug-functions/nullable", + "sql-manual/sql-functions/debug-functions/sleep" + ] + }, "sql-manual/sql-functions/cast", "sql-manual/sql-functions/digital-masking", "sql-manual/sql-functions/width-bucket" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org