From 3fad78cb26efbf5449ef0ed0cb1d9063829b3e58 Mon Sep 17 00:00:00 2001 From: lzyy2024 <2972013149@qq.com> Date: Tue, 28 Jan 2025 10:17:16 +0800 Subject: [PATCH] all --- .../string-functions/compress.md | 72 ++++++++++++++++ .../string-functions/uncompressed.md | 83 +++++++++++++++++++ .../string-functions/compress.md | 71 ++++++++++++++++ .../string-functions/uncompressed.md | 82 ++++++++++++++++++ .../string-functions/compress.md | 71 ++++++++++++++++ .../string-functions/uncompressed.md | 82 ++++++++++++++++++ sidebars.json | 2 + .../string-functions/compress.md | 72 ++++++++++++++++ .../string-functions/uncompressed.md | 83 +++++++++++++++++++ versioned_sidebars/version-3.0-sidebars.json | 2 + 10 files changed, 620 insertions(+) create mode 100644 docs/sql-manual/sql-functions/scalar-functions/string-functions/compress.md create mode 100644 docs/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md create mode 100644 i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/compress.md create mode 100644 i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md create mode 100644 i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md create mode 100644 i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md create mode 100644 versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md create mode 100644 versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md diff --git a/docs/sql-manual/sql-functions/scalar-functions/string-functions/compress.md b/docs/sql-manual/sql-functions/scalar-functions/string-functions/compress.md new file mode 100644 index 0000000000000..143b5c5de459c --- /dev/null +++ b/docs/sql-manual/sql-functions/scalar-functions/string-functions/compress.md @@ -0,0 +1,72 @@ +--- +{ + "title": "COMPRESS", + "language": "en" +} +--- + + + +## Description +The COMPRESS function is used to compress strings or values into binary data. The compressed data can be decompressed using the UNCOMPRESS function. + +## Syntax + +```sql +COMPRESS() +``` + +## Parameters + +| Parameters | Description | +|--------------------|---------------| +| `` | Uncompressed raw string | + +The parameter type is varchar or string + +## Return Value +The return string is the same as the input type +The first ten digits of the returned string are the hexadecimal length of the original string, for example, 0x01000000. Followed by the compressed value. + +Special case: +- Return '0x' when input is '' + +## Example + +``` sql +select compress('abc'); +``` +```text ++----------------------------------+ +| compress('abc') | ++----------------------------------+ +| 0x03000000789C4B4C4A0600024D0127 | ++----------------------------------+ +``` +``` +mysql> select compress(''); +``` +``` ++--------------+ +| compress('') | ++--------------+ +| 0x | ++--------------+ +``` \ No newline at end of file diff --git a/docs/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md b/docs/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md new file mode 100644 index 0000000000000..0627a136c299e --- /dev/null +++ b/docs/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md @@ -0,0 +1,83 @@ +--- +{ + "title": "UNCOMPRESS", + "language": "en" +} +--- + + + +## Description +The UNCOMPRESS function is used to extract binary data into a string or value, and the binary data needs to be the result of 'COMPRESS' + +## Syntax + +```sql +UNCOMPRESS() +``` + +## Parameters + +| Parameters | Description | +|--------------------|---------------| +| `` | Compressed binary data | + +The parameter type is varchar or string + +## Return Value +The return value is the same as the input type + +Special cases: +- Returns NULL if the binary data is not compressed. + + +## Example + +``` sql +select uncompress(compress('abc')); +``` +```text ++-----------------------------+ +| uncompress(compress('abc')) | ++-----------------------------+ +| abc | ++-----------------------------+ +``` +``` +select uncompress('0x03000000789C4B4C4A0600024D019'); +``` +``` ++-----------------------------------------------+ +| uncompress('0x03000000789C4B4C4A0600024D019') | ++-----------------------------------------------+ +| NULL | ++-----------------------------------------------+ +``` +`0x03000000789c4b4c4a0600024d019` is `compress('abc')` has carried on the tiny changes, it is illegal. +``` +select uncompress(compress('')); +``` +``` ++--------------------------+ +| uncompress(compress('')) | ++--------------------------+ +| | ++--------------------------+ +``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/compress.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/compress.md new file mode 100644 index 0000000000000..e9c29efc3f7a6 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/compress.md @@ -0,0 +1,71 @@ +--- +{ + "title": "COMPRESS", + "language": "zh-CN" +} +--- + + + +## 描述 +COMPRESS 函数用于将字符串或值压缩成二进制数据,压缩后的数据可通过 `UNCOMPRESS` 函数解压还原。 + +## 语法 + +```sql +COMPRESS() +``` + +## 参数 + +| 参数 | 说明 | +|--------------------|---------------| +| `` | 未压缩的原串 | + +参数类型是varchar或者string + +## 返回值 +返回串与输入的 类型一致 +返回串的前十位是原串长度的十六进制形式, 例如: 0x01000000。后面的是压缩值。 +特殊情况: +- 输入为 ‘’ 时,返回 '0x' + +## 举例 + +``` sql +select compress('abc'); +``` +```text ++----------------------------------+ +| compress('abc') | ++----------------------------------+ +| 0x03000000789C4B4C4A0600024D0127 | ++----------------------------------+ +``` +``` +mysql> select compress(''); +``` +``` ++--------------+ +| compress('') | ++--------------+ +| 0x | ++--------------+ +``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md new file mode 100644 index 0000000000000..afba470fc2cd8 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md @@ -0,0 +1,82 @@ +--- +{ + "title": "UNCOMPRESS", + "language": "zh-CN" +} +--- + + + +## 描述 +UNCOMPRESS 函数用于将二进制数据解压缩成字符串或值,二进制数据需要是`COMPRESS`的结果 + +## 语法 + +```sql +UNCOMPRESS() +``` + +## 参数 + +| 参数 | 说明 | +|--------------------|---------------| +| `` | 压缩得到的二进制数据 | + +参数类型是varchar或者string + +## 返回值 +返回值与输入的 类型一致 +特殊情况: +- 输入不是`COMPRESS`得到的二进制数据时, 返回 NULL. + + +## 举例 + +``` sql +select uncompress(compress('abc')); +``` +```text ++-----------------------------+ +| uncompress(compress('abc')) | ++-----------------------------+ +| abc | ++-----------------------------+ +``` +``` +select uncompress('0x03000000789C4B4C4A0600024D019'); +``` +``` ++-----------------------------------------------+ +| uncompress('0x03000000789C4B4C4A0600024D019') | ++-----------------------------------------------+ +| NULL | ++-----------------------------------------------+ +``` +`0x03000000789C4B4C4A0600024D019`是compress('abc')进行了微小的修改,它是非法的。 +``` +select uncompress(compress('')); +``` +``` ++--------------------------+ +| uncompress(compress('')) | ++--------------------------+ +| | ++--------------------------+ +``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md new file mode 100644 index 0000000000000..f489b28aeb070 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md @@ -0,0 +1,71 @@ +--- +{ + "title": "COMPRESS", + "language": "zh-CN" +} +--- + + + +## 描述 +COMPRESS 函数用于将字符串或值压缩成二进制数据,压缩后的数据可通过 `UNCOMPRESS` 函数解压还原。 + +## 语法 + +```sql +COMPRESS() +``` + +## 参数 + +| 参数 | 说明 | +|--------------------|---------------| +| `` | 未压缩的原串 | + +参数类型是varchar或者string + +## 返回值 +返回串与输入的 类型一致 +返回串的前十位是原串长度的十六进制形式, 例如: 0x01000000。后面的是压缩值。 +特殊情况: +- 输入为 ‘’ 时,返回 '0x' + +## 举例 + +``` sql +select compress('abc'); +``` +```text ++----------------------------------+ +| compress('abc') | ++----------------------------------+ +| 0x03000000789C4B4C4A0600024D0127 | ++----------------------------------+ +``` +``` +mysql> select compress(''); +``` +``` ++--------------+ +| compress('') | ++--------------+ +| 0x | ++--------------+ +``` \ No newline at end of file diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md new file mode 100644 index 0000000000000..afba470fc2cd8 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md @@ -0,0 +1,82 @@ +--- +{ + "title": "UNCOMPRESS", + "language": "zh-CN" +} +--- + + + +## 描述 +UNCOMPRESS 函数用于将二进制数据解压缩成字符串或值,二进制数据需要是`COMPRESS`的结果 + +## 语法 + +```sql +UNCOMPRESS() +``` + +## 参数 + +| 参数 | 说明 | +|--------------------|---------------| +| `` | 压缩得到的二进制数据 | + +参数类型是varchar或者string + +## 返回值 +返回值与输入的 类型一致 +特殊情况: +- 输入不是`COMPRESS`得到的二进制数据时, 返回 NULL. + + +## 举例 + +``` sql +select uncompress(compress('abc')); +``` +```text ++-----------------------------+ +| uncompress(compress('abc')) | ++-----------------------------+ +| abc | ++-----------------------------+ +``` +``` +select uncompress('0x03000000789C4B4C4A0600024D019'); +``` +``` ++-----------------------------------------------+ +| uncompress('0x03000000789C4B4C4A0600024D019') | ++-----------------------------------------------+ +| NULL | ++-----------------------------------------------+ +``` +`0x03000000789C4B4C4A0600024D019`是compress('abc')进行了微小的修改,它是非法的。 +``` +select uncompress(compress('')); +``` +``` ++--------------------------+ +| uncompress(compress('')) | ++--------------------------+ +| | ++--------------------------+ +``` \ No newline at end of file diff --git a/sidebars.json b/sidebars.json index 87cecff3af86d..4bc6c562e2415 100644 --- a/sidebars.json +++ b/sidebars.json @@ -941,11 +941,13 @@ "sql-manual/sql-functions/scalar-functions/string-functions/rpad", "sql-manual/sql-functions/scalar-functions/string-functions/lcase", "sql-manual/sql-functions/scalar-functions/string-functions/ucase", + "sql-manual/sql-functions/scalar-functions/string-functions/uncompress", "sql-manual/sql-functions/scalar-functions/string-functions/initcap", "sql-manual/sql-functions/scalar-functions/string-functions/repeat", "sql-manual/sql-functions/scalar-functions/string-functions/reverse", "sql-manual/sql-functions/scalar-functions/string-functions/char", "sql-manual/sql-functions/scalar-functions/string-functions/concat", + "sql-manual/sql-functions/scalar-functions/string-functions/compress", "sql-manual/sql-functions/scalar-functions/string-functions/concat-ws", "sql-manual/sql-functions/scalar-functions/string-functions/substring", "sql-manual/sql-functions/scalar-functions/string-functions/count_substrings", diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md new file mode 100644 index 0000000000000..143b5c5de459c --- /dev/null +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/compress.md @@ -0,0 +1,72 @@ +--- +{ + "title": "COMPRESS", + "language": "en" +} +--- + + + +## Description +The COMPRESS function is used to compress strings or values into binary data. The compressed data can be decompressed using the UNCOMPRESS function. + +## Syntax + +```sql +COMPRESS() +``` + +## Parameters + +| Parameters | Description | +|--------------------|---------------| +| `` | Uncompressed raw string | + +The parameter type is varchar or string + +## Return Value +The return string is the same as the input type +The first ten digits of the returned string are the hexadecimal length of the original string, for example, 0x01000000. Followed by the compressed value. + +Special case: +- Return '0x' when input is '' + +## Example + +``` sql +select compress('abc'); +``` +```text ++----------------------------------+ +| compress('abc') | ++----------------------------------+ +| 0x03000000789C4B4C4A0600024D0127 | ++----------------------------------+ +``` +``` +mysql> select compress(''); +``` +``` ++--------------+ +| compress('') | ++--------------+ +| 0x | ++--------------+ +``` \ No newline at end of file diff --git a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md new file mode 100644 index 0000000000000..7ff79d73d0407 --- /dev/null +++ b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/string-functions/uncompressed.md @@ -0,0 +1,83 @@ +--- +{ + "title": "UNCOMPRESS", + "language": "en" +} +--- + + + +## Description +The UNCOMPRESS function is used to extract binary data into a string or value, and the binary data needs to be the result of 'COMPRESS' + +## Syntax + +```sql +UNCOMPRESS() +``` + +## Parameters + +| Parameters | Description | +|--------------------|---------------| +| `` | Compressed binary data | + +The parameter type is varchar or string + +## Return Value +The return value is the same as the input type + +Special cases: +- Returns NULL if the binary data is not compressed. + + +## Example + +``` sql +select uncompress(compress('abc')); +``` +```text ++-----------------------------+ +| uncompress(compress('abc')) | ++-----------------------------+ +| abc | ++-----------------------------+ +``` +``` +select uncompress('0x03000000789C4B4C4A0600024D019'); +``` +``` ++-----------------------------------------------+ +| uncompress('0x03000000789C4B4C4A0600024D019') | ++-----------------------------------------------+ +| NULL | ++-----------------------------------------------+ +``` +`0x03000000789c4b4c4a0600024d019` is `compress('abc')` has carried on the tiny changes, it is illegal. +``` +select uncompress(compress('')); +``` +``` ++--------------------------+ +| uncompress(compress('')) | ++--------------------------+ +| | ++--------------------------+ +``` \ No newline at end of file diff --git a/versioned_sidebars/version-3.0-sidebars.json b/versioned_sidebars/version-3.0-sidebars.json index c71895351dd2a..ea325edd6d0f0 100644 --- a/versioned_sidebars/version-3.0-sidebars.json +++ b/versioned_sidebars/version-3.0-sidebars.json @@ -993,11 +993,13 @@ "sql-manual/sql-functions/scalar-functions/string-functions/rpad", "sql-manual/sql-functions/scalar-functions/string-functions/lcase", "sql-manual/sql-functions/scalar-functions/string-functions/ucase", + "sql-manual/sql-functions/scalar-functions/string-functions/uncompress", "sql-manual/sql-functions/scalar-functions/string-functions/initcap", "sql-manual/sql-functions/scalar-functions/string-functions/repeat", "sql-manual/sql-functions/scalar-functions/string-functions/reverse", "sql-manual/sql-functions/scalar-functions/string-functions/char", "sql-manual/sql-functions/scalar-functions/string-functions/concat", + "sql-manual/sql-functions/scalar-functions/string-functions/compress", "sql-manual/sql-functions/scalar-functions/string-functions/concat-ws", "sql-manual/sql-functions/scalar-functions/string-functions/substring", "sql-manual/sql-functions/scalar-functions/string-functions/count_substrings",