This is an automated email from the ASF dual-hosted git repository. kassiez 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 9605408496d 3rd data query - update by ai (#2103) 9605408496d is described below commit 9605408496d772c3772d13af99a4073aabafbb6a Author: wangtianyi2004 <376612...@qq.com> AuthorDate: Fri Feb 21 18:54:48 2025 +0800 3rd data query - update by ai (#2103) ## Versions - [x] dev - [x] 3.0 - [x] 2.1 - [ ] 2.0 ## Languages - [x] Chinese - [x] English ## Docs Checklist - [x] Checked by AI - [ ] Test Cases Built --- docs/query-data/cte.md | 2 +- docs/query-data/lateral-view.md | 4 ++-- docs/query-data/mysql-compatibility.md | 4 ++-- .../current/query-data/cte.md | 4 ++-- .../current/query-data/join.md | 2 +- .../current/query-data/multi-dimensional-analytics.md | 8 ++++---- .../current/query-data/mysql-compatibility.md | 10 +++++----- .../current/query-data/udf/java-user-defined-function.md | 12 ++++++------ .../current/query-data/window-function.md | 8 ++++---- .../version-2.1/query-data/cte.md | 4 ++-- .../version-2.1/query-data/join.md | 2 +- .../version-2.1/query-data/multi-dimensional-analytics.md | 8 ++++---- .../version-2.1/query-data/mysql-compatibility.md | 10 +++++----- .../version-2.1/query-data/subquery.md | 14 +++++++------- .../query-data/udf/java-user-defined-function.md | 12 ++++++------ .../version-2.1/query-data/window-function.md | 8 ++++---- .../version-3.0/query-data/cte.md | 4 ++-- .../version-3.0/query-data/join.md | 2 +- .../version-3.0/query-data/multi-dimensional-analytics.md | 10 +++++----- .../version-3.0/query-data/mysql-compatibility.md | 10 +++++----- .../version-3.0/query-data/subquery.md | 2 +- .../query-data/udf/java-user-defined-function.md | 12 ++++++------ .../version-3.0/query-data/window-function.md | 8 ++++---- versioned_docs/version-2.1/query-data/cte.md | 2 +- versioned_docs/version-2.1/query-data/lateral-view.md | 4 ++-- .../version-2.1/query-data/multi-dimensional-analytics.md | 2 +- .../version-2.1/query-data/mysql-compatibility.md | 6 +++--- versioned_docs/version-2.1/query-data/subquery.md | 14 +++++++------- .../query-data/udf/java-user-defined-function.md | 2 +- versioned_docs/version-2.1/query-data/window-function.md | 1 + versioned_docs/version-3.0/query-data/cte.md | 2 +- versioned_docs/version-3.0/query-data/lateral-view.md | 4 ++-- .../version-3.0/query-data/mysql-compatibility.md | 6 +++--- .../query-data/udf/java-user-defined-function.md | 2 +- 34 files changed, 103 insertions(+), 102 deletions(-) diff --git a/docs/query-data/cte.md b/docs/query-data/cte.md index a3d87b474db..1f647212cd4 100644 --- a/docs/query-data/cte.md +++ b/docs/query-data/cte.md @@ -26,7 +26,7 @@ under the License. ## Description -Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTE are primarily used in SELECT statements. +Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTEs are primarily used in SELECT statements. To specify a CTE, use the `WITH` clause with one or more comma-separated clauses. Each clause provides a subquery that generates a result set and associates a name with the subquery. diff --git a/docs/query-data/lateral-view.md b/docs/query-data/lateral-view.md index 9f506efdcfa..65dd1eb2656 100644 --- a/docs/query-data/lateral-view.md +++ b/docs/query-data/lateral-view.md @@ -26,7 +26,7 @@ under the License. # Column to Row (Lateral View) -Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw output row. +Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw input row. ## Grammar @@ -46,7 +46,7 @@ LATERAL VIEW generator_function ( expression [, ...] ) table_identifier AS colu - column_identifier - List column alias `generator_function`, which can be used to output rows. The number of column identifiers must match the number of columns returned by the generator function. + List column alias `generator_function`, which can be used to reference the output columns. The number of column identifiers must match the number of columns returned by the generator function. ## Example diff --git a/docs/query-data/mysql-compatibility.md b/docs/query-data/mysql-compatibility.md index 7742792a8b5..165c6b2ff79 100644 --- a/docs/query-data/mysql-compatibility.md +++ b/docs/query-data/mysql-compatibility.md @@ -36,8 +36,8 @@ Doris is highly compatible with MySQL syntax and supports standard SQL. However, | Bit | <p>- Supported</p> <p>- Range: 1 to 64</p> | Not supported | | Tinyint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -128 to 127, unsigned range from 0 to 255 </p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -128 to 127</p> | | Smallint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p> - Range: signed range from -2^15 to 2^15-1, unsigned range from 0 to 2^16-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -32768 to 32767</p> | -| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to -2^24-1</p> | - Not supported | -| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to -2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | +| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to 2^24-1</p> | - Not supported | +| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to 2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | | Bigint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^63 to 2^63-1, unsigned range from 0 to 2^64-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^63 to 2^63-1</p> | | Largeint | - Not supported | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^127 to 2^127-1</p> | | Decimal | <p>- Supported</p> <p>- Supports signed and unsigned (deprecated after 8.0.17)</p> <p>- Default: Decimal(10, 0)</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Default: Decimal(9, 0)</p> | diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/cte.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/cte.md index 6ff776fe675..e98897605c4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/cte.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/cte.md @@ -42,8 +42,8 @@ Doris **不支持** 递归 CTE。有关递归 CTE 的详细解释,可以参考 ```sql WITH - cte1 AS(SELECT a,b FROM table1), - cte2 AS(SELECT c,d FROM table2) + cte1 AS (SELECT a,b FROM table1), + cte2 AS (SELECT c,d FROM table2) SELECT b,d FROM cte1 JOIN cte2 WHERE cte1.a = cte2.c; ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/join.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/join.md index 8a018314793..7dffaad1a9a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/join.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/join.md @@ -38,7 +38,7 @@ under the License. - RIGHT JOIN(右连接):与 LEFT JOIN 相反,如果右表的行在左表中没有匹配,则返回右表的所有行,同时左表对应的列显示为 NULL。 -- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有 +- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有匹配,则另一侧表的相应列显示为 NULL。 - CROSS JOIN(交叉连接):没有 JOIN 条件,返回两个表的笛卡尔积,即左表的每一行与右表的每一行都进行组合。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/multi-dimensional-analytics.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/multi-dimensional-analytics.md index 020f82405c3..a68502b15b4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/multi-dimensional-analytics.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/multi-dimensional-analytics.md @@ -170,7 +170,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; ## GROUPING FUNCTION -本节将对介绍通过如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: +本节将介绍如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: 1. 如何以编程方式识别出哪些结果集行代表小计,以及如何准确找到给定小计对应的聚合层级。由于在计算(如总计百分比)时经常需要使用小计,因此,我们需要一种简便的方法来识别这些小计行。 @@ -182,7 +182,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; **1. 原理介绍** -GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL)都返回 0。 +GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL 值)都返回 0。 示例如下: @@ -322,7 +322,7 @@ group by cube(year(d_date), i_category) 在数据库中,GROUPING_ID 和 GROUPING 函数都是用于处理多维数据聚合查询(如 ROLLUP 和 CUBE)时的辅助函数,它们帮助用户区分不同层级的聚合结果。如果你想确定某一行的聚合层级,你需要使用 GROUPING 函数对所有的 GROUP BY 列进行计算,因为单列的计算结果无法满足需求。 -GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 +GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 函数表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 以 CUBE(a, b) 为例,其 GROUPING_ID 可以表示为: @@ -457,7 +457,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; 16 rows in set (0.11 sec) ``` -上面的写法等价于使用 CUBE,但指定了具体的 `grouping_id`,从而减少了不必要的计算: +上面的写法等价于使用 CUBE,但通过 `grouping_id` 指定了具体的聚合组合,从而减少了不必要的计算: ```sql SELECT diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/mysql-compatibility.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/mysql-compatibility.md index 9a620e0ab16..ae4620c234b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/mysql-compatibility.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/mysql-compatibility.md @@ -37,8 +37,8 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 | Bit | - 支持 <br />- 范围:1 ~ 64 | 不支持 | | Tinyint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -128 ~ 127,unsigned 的范围是 0 ~ 255 | - 支持 <br />- 只支持 signed <br />- 范围:-128 ~ 127 | | Smallint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^15 ~ 2^15-1,unsigned 的范围是 0 ~ 2^16-1 | - 支持 <br />- 只支持 signed <br />- 范围:-32768 ~ 32767 | -| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ -2^24-1 | - 不支持 | -| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ -2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | +| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ 2^24-1 | - 不支持 | +| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ 2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | | Bigint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^63 ~ 2^63-1,unsigned 的范围是 0 ~ 2^64-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2^63 ~ 2^63-1 | | Largeint | - 不支持 | - 支持 <br />- 只支持 signed <br />- 范围:-2^127 ~ 2^127-1 | | Decimal | - 支持 <br />- 支持 signed,unsigned(8.0.17 以前支持,该版本以上标记为 deprecated)<br />- 默认值:Decimal(10, 0)| - 支持 <br />- 只支持 signed <br />- 默认值:Decimal(9, 0) | @@ -94,9 +94,9 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 QUANTILE_STATE 是一种计算分位数近似值的类型,在导入时会对相同的 Key,不同 Value 进行预聚合,当 Value 数量不超过 2048 时,会采用明细记录所有数据,当 Value 数量大于 2048 时采用 [TDigest](https://github.com/tdunning/t-digest/blob/main/docs/t-digest-paper/histo.pdf) 算法,对数据进行聚合(聚类),并保存聚类后的质心点。 -- **Array<T\>** +- **Array<T>** - Array 由 T 类型元素组成的数组,不能作为 Key 列使用。 + Array<T> 由 T 类型元素组成的数组,不能作为 Key 列使用。 - **MAP<K, V>** @@ -176,7 +176,7 @@ CREATE VIEW [IF NOT EXISTS] (column1[ COMMENT "col comment"][, column2, ...]) AS query_stmt -CREATE MATERIALIZED VIEW (IF NOT EXISTS)? mvName=multipartIdentifier +CREATE MATERIALIZED VIEW [IF NOT EXISTS] mvName=multipartIdentifier (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)? buildMode? (REFRESH refreshMethod? refreshTrigger?)? (KEY keys=identifierList)? diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/java-user-defined-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/java-user-defined-function.md index 7c14f66e179..5f629212a85 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/java-user-defined-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/java-user-defined-function.md @@ -25,7 +25,7 @@ under the License. --> ## 概述 -Java UDF 为用户提供 UDF 编写的 Java 接口,以方便用户使用 Java 语言进行自定义函数的执行。 +Java UDF 为用户提供使用 Java 编写 UDF 的接口,以方便用户使用 Java 语言进行自定义函数的执行。 Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明,使用 UDF 统称所有用户自定义函数。 1. Java UDF 是较为常见的自定义标量函数 (Scalar Function),即每输入一行数据,就会有一行对应的结果输出,较为常见的有 ABS,LENGTH 等。值得一提的是对于用户来讲,Hive UDF 是可以直接迁移至 Doris 的。 2. Java UDAF 即为自定义的聚合函数 (Aggregate Function),即在输入多行数据进行聚合后,仅输出一行对应的结果,较为常见的有 MIN,MAX,COUNT 等。 @@ -69,7 +69,7 @@ Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明, ## 快速上手 -本小节主要介绍如何开发一个 Java UDF。在 `samples/doris-demo/java-udf-demo/` 下提供了示例,可供参考,查看点击[这里](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo) +本节主要介绍如何开发 Java UDF。在 `samples/doris-demo/java-udf-demo/` 目录下提供了示例代码,供您参考。您也可以查看 [demo](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo)。 UDF 的使用与普通的函数方式一致,唯一的区别在于,内置函数的作用域是全局的,而 UDF 的作用域是 DB 内部。 所以如果当前链接 session 位于数据库 DB 内部时,直接使用 UDF 名字会在当前 DB 内部查找对应的 UDF。否则用户需要显示的指定 UDF 的数据库名字,例如 `dbName.funcName`。 @@ -368,11 +368,11 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, } ``` -2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上`_outer`后缀,其中带后缀`_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 +2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上 `_outer` 后缀,其中带后缀 `_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 更多语法帮助可参阅 [CREATE FUNCTION](../../sql-manual/sql-statements/function/CREATE-FUNCTION). ```sql - CREATE TABLES FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( + CREATE TABLE FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( "file"="file:///pathTo/java-udtf.jar", "symbol"="org.apache.doris.udf.demo.UDTFStringTest", "always_nullable"="true", @@ -408,7 +408,7 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, *解决方案 1:* -是可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 +可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 假设已经将代码拆分为了 DictLibrary 和 FunctionUdf 两个文件。 @@ -451,7 +451,7 @@ public class FunctionUdf { jar -cf ./DictLibrary.jar ./DictLibrary.class ``` -2. 编译 FunctionUdf 文件,需要引用上一步的到的资源包最为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 +2. 编译 FunctionUdf 文件,需要引用上一步得到的资源包作为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 ```shell javac -cp ./DictLibrary.jar ./FunctionUdf.java diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/window-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/window-function.md index 48647c68dad..7c7583d79b2 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/window-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/window-function.md @@ -1,6 +1,6 @@ --- { - "title": "分析函数 (窗口函数)", + "title": "分析函数(窗口函数)", "language": "zh-CN" } --- @@ -378,7 +378,7 @@ GROUP BY ## 报告函数 -报告函数是指每一行的窗口范围都是整个 Partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: +报告函数是指每一行的窗口范围都是整个 partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: ```sql select year,category,total_sum from ( @@ -427,7 +427,7 @@ where total_sum=max_sales; 2 rows in set (0.12 sec) ``` -你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品。为例,查询语句如下: +你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品”为例,查询语句如下: ```sql select i_category as categ, i_class as sub_categ, i_item_id @@ -449,7 +449,7 @@ where sub_cat_sales>0.2*cat_sales and rank_in_line<=5; ## LAG / LEAD 函数 -LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,皆可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 +LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,均可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 以下是一个使用 LAG 函数的 SQL 查询示例,该查询希望选取特定年份(1999, 2000, 2001, 2002)中,每个商品类别的总销售额、前一年的总销售额以及两者之间的差异: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/cte.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/cte.md index 6ff776fe675..e98897605c4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/cte.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/cte.md @@ -42,8 +42,8 @@ Doris **不支持** 递归 CTE。有关递归 CTE 的详细解释,可以参考 ```sql WITH - cte1 AS(SELECT a,b FROM table1), - cte2 AS(SELECT c,d FROM table2) + cte1 AS (SELECT a,b FROM table1), + cte2 AS (SELECT c,d FROM table2) SELECT b,d FROM cte1 JOIN cte2 WHERE cte1.a = cte2.c; ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/join.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/join.md index 8a018314793..7dffaad1a9a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/join.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/join.md @@ -38,7 +38,7 @@ under the License. - RIGHT JOIN(右连接):与 LEFT JOIN 相反,如果右表的行在左表中没有匹配,则返回右表的所有行,同时左表对应的列显示为 NULL。 -- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有 +- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有匹配,则另一侧表的相应列显示为 NULL。 - CROSS JOIN(交叉连接):没有 JOIN 条件,返回两个表的笛卡尔积,即左表的每一行与右表的每一行都进行组合。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/multi-dimensional-analytics.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/multi-dimensional-analytics.md index 020f82405c3..a68502b15b4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/multi-dimensional-analytics.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/multi-dimensional-analytics.md @@ -170,7 +170,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; ## GROUPING FUNCTION -本节将对介绍通过如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: +本节将介绍如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: 1. 如何以编程方式识别出哪些结果集行代表小计,以及如何准确找到给定小计对应的聚合层级。由于在计算(如总计百分比)时经常需要使用小计,因此,我们需要一种简便的方法来识别这些小计行。 @@ -182,7 +182,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; **1. 原理介绍** -GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL)都返回 0。 +GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL 值)都返回 0。 示例如下: @@ -322,7 +322,7 @@ group by cube(year(d_date), i_category) 在数据库中,GROUPING_ID 和 GROUPING 函数都是用于处理多维数据聚合查询(如 ROLLUP 和 CUBE)时的辅助函数,它们帮助用户区分不同层级的聚合结果。如果你想确定某一行的聚合层级,你需要使用 GROUPING 函数对所有的 GROUP BY 列进行计算,因为单列的计算结果无法满足需求。 -GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 +GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 函数表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 以 CUBE(a, b) 为例,其 GROUPING_ID 可以表示为: @@ -457,7 +457,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; 16 rows in set (0.11 sec) ``` -上面的写法等价于使用 CUBE,但指定了具体的 `grouping_id`,从而减少了不必要的计算: +上面的写法等价于使用 CUBE,但通过 `grouping_id` 指定了具体的聚合组合,从而减少了不必要的计算: ```sql SELECT diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/mysql-compatibility.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/mysql-compatibility.md index 9a620e0ab16..ae4620c234b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/mysql-compatibility.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/mysql-compatibility.md @@ -37,8 +37,8 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 | Bit | - 支持 <br />- 范围:1 ~ 64 | 不支持 | | Tinyint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -128 ~ 127,unsigned 的范围是 0 ~ 255 | - 支持 <br />- 只支持 signed <br />- 范围:-128 ~ 127 | | Smallint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^15 ~ 2^15-1,unsigned 的范围是 0 ~ 2^16-1 | - 支持 <br />- 只支持 signed <br />- 范围:-32768 ~ 32767 | -| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ -2^24-1 | - 不支持 | -| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ -2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | +| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ 2^24-1 | - 不支持 | +| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ 2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | | Bigint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^63 ~ 2^63-1,unsigned 的范围是 0 ~ 2^64-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2^63 ~ 2^63-1 | | Largeint | - 不支持 | - 支持 <br />- 只支持 signed <br />- 范围:-2^127 ~ 2^127-1 | | Decimal | - 支持 <br />- 支持 signed,unsigned(8.0.17 以前支持,该版本以上标记为 deprecated)<br />- 默认值:Decimal(10, 0)| - 支持 <br />- 只支持 signed <br />- 默认值:Decimal(9, 0) | @@ -94,9 +94,9 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 QUANTILE_STATE 是一种计算分位数近似值的类型,在导入时会对相同的 Key,不同 Value 进行预聚合,当 Value 数量不超过 2048 时,会采用明细记录所有数据,当 Value 数量大于 2048 时采用 [TDigest](https://github.com/tdunning/t-digest/blob/main/docs/t-digest-paper/histo.pdf) 算法,对数据进行聚合(聚类),并保存聚类后的质心点。 -- **Array<T\>** +- **Array<T>** - Array 由 T 类型元素组成的数组,不能作为 Key 列使用。 + Array<T> 由 T 类型元素组成的数组,不能作为 Key 列使用。 - **MAP<K, V>** @@ -176,7 +176,7 @@ CREATE VIEW [IF NOT EXISTS] (column1[ COMMENT "col comment"][, column2, ...]) AS query_stmt -CREATE MATERIALIZED VIEW (IF NOT EXISTS)? mvName=multipartIdentifier +CREATE MATERIALIZED VIEW [IF NOT EXISTS] mvName=multipartIdentifier (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)? buildMode? (REFRESH refreshMethod? refreshTrigger?)? (KEY keys=identifierList)? diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/subquery.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/subquery.md index 88e4c8b5b05..48202a31e7b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/subquery.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/subquery.md @@ -302,25 +302,25 @@ where ## 常见问题 -由于标量子查询的输出必须是一个单值,Doris 对于关联和非关联的标量子查询采取了不同的处理方式。 +由于标量子查询的输出必须是一个单值,如果子查询返回的数据量超过一条记录,将会报告运行时错误。 ### 对于关联的标量子查询 -目前 Doris 暂时只能以静态的方式确保子查询输出为单值(即没有 `group by` 的单个聚合函数)。因此,在使用关联标量子查询时,需要根据需求添加没有 `group by` 的聚合函数,如`any_value`,以便优化器能顺利识别单值语义。用户需要保证子查询一定只返回一个值,如果子查询实际返回多个值(其他数据库系统会在运行时报错),由于添加了聚合函数,它始终只返回一个值,虽然能得到结果,但可能和预期不符。 +在使用关联标量子查询时,如果满足关联条件的子查询返回的数据量超过一条记录,将会报告运行时错误。 请参考以下 SQL 示例: ```sql --- 关联的标量子查询,缺少单个无 group by 的聚合函数,目前不支持 -select t1.*, (select t2.c1 from t2 where t1.c2 = t2.c2) from t1; +-- 关联的标量子查询,如果 t2 表中满足 t1.c2 = t2.c2 的数据多于 1 条,则会报运行时错误 +select t1.*, (select t2.c1 from t2 where t1.c2 = t2.c2) from t1; --- 添加单个聚合函数,让优化器顺利识别 -select t1.*, (select any_value(t2.c1) from t2 where t1.c2 = t2.c2) from t1; +-- 报错信息样例如下 +ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[INVALID_ARGUMENT][E33] correlate scalar subquery must return only 1 row ``` ### 对于非关联的标量子查询 -Doris 会在运行时添加一个`assert num rows`算子,如果子查询返回的数据大于一条,则会报一个运行时错误。 +Doris 会在运行时添加一个`assert num rows`算子,如果子查询返回的数据量超过一条记录,将会报告运行时错误。 请参考以下 SQL 示例: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/udf/java-user-defined-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/udf/java-user-defined-function.md index 7c14f66e179..5f629212a85 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/udf/java-user-defined-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/udf/java-user-defined-function.md @@ -25,7 +25,7 @@ under the License. --> ## 概述 -Java UDF 为用户提供 UDF 编写的 Java 接口,以方便用户使用 Java 语言进行自定义函数的执行。 +Java UDF 为用户提供使用 Java 编写 UDF 的接口,以方便用户使用 Java 语言进行自定义函数的执行。 Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明,使用 UDF 统称所有用户自定义函数。 1. Java UDF 是较为常见的自定义标量函数 (Scalar Function),即每输入一行数据,就会有一行对应的结果输出,较为常见的有 ABS,LENGTH 等。值得一提的是对于用户来讲,Hive UDF 是可以直接迁移至 Doris 的。 2. Java UDAF 即为自定义的聚合函数 (Aggregate Function),即在输入多行数据进行聚合后,仅输出一行对应的结果,较为常见的有 MIN,MAX,COUNT 等。 @@ -69,7 +69,7 @@ Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明, ## 快速上手 -本小节主要介绍如何开发一个 Java UDF。在 `samples/doris-demo/java-udf-demo/` 下提供了示例,可供参考,查看点击[这里](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo) +本节主要介绍如何开发 Java UDF。在 `samples/doris-demo/java-udf-demo/` 目录下提供了示例代码,供您参考。您也可以查看 [demo](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo)。 UDF 的使用与普通的函数方式一致,唯一的区别在于,内置函数的作用域是全局的,而 UDF 的作用域是 DB 内部。 所以如果当前链接 session 位于数据库 DB 内部时,直接使用 UDF 名字会在当前 DB 内部查找对应的 UDF。否则用户需要显示的指定 UDF 的数据库名字,例如 `dbName.funcName`。 @@ -368,11 +368,11 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, } ``` -2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上`_outer`后缀,其中带后缀`_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 +2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上 `_outer` 后缀,其中带后缀 `_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 更多语法帮助可参阅 [CREATE FUNCTION](../../sql-manual/sql-statements/function/CREATE-FUNCTION). ```sql - CREATE TABLES FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( + CREATE TABLE FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( "file"="file:///pathTo/java-udtf.jar", "symbol"="org.apache.doris.udf.demo.UDTFStringTest", "always_nullable"="true", @@ -408,7 +408,7 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, *解决方案 1:* -是可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 +可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 假设已经将代码拆分为了 DictLibrary 和 FunctionUdf 两个文件。 @@ -451,7 +451,7 @@ public class FunctionUdf { jar -cf ./DictLibrary.jar ./DictLibrary.class ``` -2. 编译 FunctionUdf 文件,需要引用上一步的到的资源包最为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 +2. 编译 FunctionUdf 文件,需要引用上一步得到的资源包作为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 ```shell javac -cp ./DictLibrary.jar ./FunctionUdf.java diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/window-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/window-function.md index 48647c68dad..7c7583d79b2 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/window-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/query-data/window-function.md @@ -1,6 +1,6 @@ --- { - "title": "分析函数 (窗口函数)", + "title": "分析函数(窗口函数)", "language": "zh-CN" } --- @@ -378,7 +378,7 @@ GROUP BY ## 报告函数 -报告函数是指每一行的窗口范围都是整个 Partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: +报告函数是指每一行的窗口范围都是整个 partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: ```sql select year,category,total_sum from ( @@ -427,7 +427,7 @@ where total_sum=max_sales; 2 rows in set (0.12 sec) ``` -你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品。为例,查询语句如下: +你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品”为例,查询语句如下: ```sql select i_category as categ, i_class as sub_categ, i_item_id @@ -449,7 +449,7 @@ where sub_cat_sales>0.2*cat_sales and rank_in_line<=5; ## LAG / LEAD 函数 -LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,皆可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 +LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,均可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 以下是一个使用 LAG 函数的 SQL 查询示例,该查询希望选取特定年份(1999, 2000, 2001, 2002)中,每个商品类别的总销售额、前一年的总销售额以及两者之间的差异: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/cte.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/cte.md index 6ff776fe675..e98897605c4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/cte.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/cte.md @@ -42,8 +42,8 @@ Doris **不支持** 递归 CTE。有关递归 CTE 的详细解释,可以参考 ```sql WITH - cte1 AS(SELECT a,b FROM table1), - cte2 AS(SELECT c,d FROM table2) + cte1 AS (SELECT a,b FROM table1), + cte2 AS (SELECT c,d FROM table2) SELECT b,d FROM cte1 JOIN cte2 WHERE cte1.a = cte2.c; ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/join.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/join.md index 8a018314793..7dffaad1a9a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/join.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/join.md @@ -38,7 +38,7 @@ under the License. - RIGHT JOIN(右连接):与 LEFT JOIN 相反,如果右表的行在左表中没有匹配,则返回右表的所有行,同时左表对应的列显示为 NULL。 -- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有 +- FULL JOIN(全连接):在 INNER JOIN 的结果集基础上。返回两个表中所有的行,如果某行在另一侧表中没有匹配,则另一侧表的相应列显示为 NULL。 - CROSS JOIN(交叉连接):没有 JOIN 条件,返回两个表的笛卡尔积,即左表的每一行与右表的每一行都进行组合。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/multi-dimensional-analytics.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/multi-dimensional-analytics.md index 72599ba2283..a68502b15b4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/multi-dimensional-analytics.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/multi-dimensional-analytics.md @@ -170,7 +170,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; ## GROUPING FUNCTION -本节将对介绍通过如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: +本节将介绍如何解决使用 ROLLUP 和 CUBE 时出现的两个挑战: 1. 如何以编程方式识别出哪些结果集行代表小计,以及如何准确找到给定小计对应的聚合层级。由于在计算(如总计百分比)时经常需要使用小计,因此,我们需要一种简便的方法来识别这些小计行。 @@ -182,7 +182,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; **1. 原理介绍** -GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL)都返回 0。 +GROUPING 使用单个列作为参数,在遇到由 ROLLUP 或 CUBE 操作创建的 NULL 值时返回 1,即 NULL 表示该行是小计,则 GROUPING 返回 1。任何其他类型的值(包括表数据中本身的 NULL 值)都返回 0。 示例如下: @@ -322,7 +322,7 @@ group by cube(year(d_date), i_category) 在数据库中,GROUPING_ID 和 GROUPING 函数都是用于处理多维数据聚合查询(如 ROLLUP 和 CUBE)时的辅助函数,它们帮助用户区分不同层级的聚合结果。如果你想确定某一行的聚合层级,你需要使用 GROUPING 函数对所有的 GROUP BY 列进行计算,因为单列的计算结果无法满足需求。 -GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 +GROUPING_ID 函数比 GROUPING 更强大,因为它可以同时对多列进行检测。GROUPING_ID 函数接受多个列作为参数,并返回一个整数,该整数通过二进制位表示多个列的聚合状态。当使用表或物化视图保存计算结果时,使用 GROUPING 函数表示聚合的不同层级会占用较多的存储空间,在这种场景下,使用 GROUPING_ID 更加合适。 以 CUBE(a, b) 为例,其 GROUPING_ID 可以表示为: @@ -457,7 +457,7 @@ ORDER BY YEAR(d_date), i_category, ca_state; 16 rows in set (0.11 sec) ``` -上面的写法等价于使用 CUBE,但指定了具体的 `grouping_id`,从而减少了不必要的计算: +上面的写法等价于使用 CUBE,但通过 `grouping_id` 指定了具体的聚合组合,从而减少了不必要的计算: ```sql SELECT @@ -549,4 +549,4 @@ HAVING grouping_id(YEAR(d_date), ca_state, i_category) = 0 ## 附录 -建表语句和数据文件见[分析函数 (窗口函数)](window-function.md)附录。 \ No newline at end of file +建表语句和数据文件见[分析函数 (窗口函数)](window-function.md)附录。 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/mysql-compatibility.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/mysql-compatibility.md index 9a620e0ab16..ae4620c234b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/mysql-compatibility.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/mysql-compatibility.md @@ -37,8 +37,8 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 | Bit | - 支持 <br />- 范围:1 ~ 64 | 不支持 | | Tinyint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -128 ~ 127,unsigned 的范围是 0 ~ 255 | - 支持 <br />- 只支持 signed <br />- 范围:-128 ~ 127 | | Smallint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^15 ~ 2^15-1,unsigned 的范围是 0 ~ 2^16-1 | - 支持 <br />- 只支持 signed <br />- 范围:-32768 ~ 32767 | -| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ -2^24-1 | - 不支持 | -| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ -2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | +| Mediumint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^23 ~ 2^23-1,unsigned 的范围是 0 ~ 2^24-1 | - 不支持 | +| int | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^31 ~ 2^31-1,unsigned 的范围是 0 ~ 2^32-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2147483648~ 2147483647 | | Bigint | - 支持 <br />- 支持 signed,unsigned <br />- 范围:signed 的范围是 -2^63 ~ 2^63-1,unsigned 的范围是 0 ~ 2^64-1 | - 支持 <br />- 只支持 signed <br />- 范围: -2^63 ~ 2^63-1 | | Largeint | - 不支持 | - 支持 <br />- 只支持 signed <br />- 范围:-2^127 ~ 2^127-1 | | Decimal | - 支持 <br />- 支持 signed,unsigned(8.0.17 以前支持,该版本以上标记为 deprecated)<br />- 默认值:Decimal(10, 0)| - 支持 <br />- 只支持 signed <br />- 默认值:Decimal(9, 0) | @@ -94,9 +94,9 @@ Doris 高度兼容 MySQL 语法,支持标准 SQL。但是 Doris 与 MySQL 还 QUANTILE_STATE 是一种计算分位数近似值的类型,在导入时会对相同的 Key,不同 Value 进行预聚合,当 Value 数量不超过 2048 时,会采用明细记录所有数据,当 Value 数量大于 2048 时采用 [TDigest](https://github.com/tdunning/t-digest/blob/main/docs/t-digest-paper/histo.pdf) 算法,对数据进行聚合(聚类),并保存聚类后的质心点。 -- **Array<T\>** +- **Array<T>** - Array 由 T 类型元素组成的数组,不能作为 Key 列使用。 + Array<T> 由 T 类型元素组成的数组,不能作为 Key 列使用。 - **MAP<K, V>** @@ -176,7 +176,7 @@ CREATE VIEW [IF NOT EXISTS] (column1[ COMMENT "col comment"][, column2, ...]) AS query_stmt -CREATE MATERIALIZED VIEW (IF NOT EXISTS)? mvName=multipartIdentifier +CREATE MATERIALIZED VIEW [IF NOT EXISTS] mvName=multipartIdentifier (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)? buildMode? (REFRESH refreshMethod? refreshTrigger?)? (KEY keys=identifierList)? diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/subquery.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/subquery.md index a99b44de0b6..48202a31e7b 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/subquery.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/subquery.md @@ -302,7 +302,7 @@ where ## 常见问题 -标量子查询必须输出单一值。若子查询返回的数据量超过一条记录,将会报告运行时错误。 +由于标量子查询的输出必须是一个单值,如果子查询返回的数据量超过一条记录,将会报告运行时错误。 ### 对于关联的标量子查询 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/udf/java-user-defined-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/udf/java-user-defined-function.md index 7c14f66e179..5f629212a85 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/udf/java-user-defined-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/udf/java-user-defined-function.md @@ -25,7 +25,7 @@ under the License. --> ## 概述 -Java UDF 为用户提供 UDF 编写的 Java 接口,以方便用户使用 Java 语言进行自定义函数的执行。 +Java UDF 为用户提供使用 Java 编写 UDF 的接口,以方便用户使用 Java 语言进行自定义函数的执行。 Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明,使用 UDF 统称所有用户自定义函数。 1. Java UDF 是较为常见的自定义标量函数 (Scalar Function),即每输入一行数据,就会有一行对应的结果输出,较为常见的有 ABS,LENGTH 等。值得一提的是对于用户来讲,Hive UDF 是可以直接迁移至 Doris 的。 2. Java UDAF 即为自定义的聚合函数 (Aggregate Function),即在输入多行数据进行聚合后,仅输出一行对应的结果,较为常见的有 MIN,MAX,COUNT 等。 @@ -69,7 +69,7 @@ Doris 支持使用 JAVA 编写 UDF、UDAF 和 UDTF。下文如无特殊说明, ## 快速上手 -本小节主要介绍如何开发一个 Java UDF。在 `samples/doris-demo/java-udf-demo/` 下提供了示例,可供参考,查看点击[这里](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo) +本节主要介绍如何开发 Java UDF。在 `samples/doris-demo/java-udf-demo/` 目录下提供了示例代码,供您参考。您也可以查看 [demo](https://github.com/apache/doris/tree/master/samples/doris-demo/java-udf-demo)。 UDF 的使用与普通的函数方式一致,唯一的区别在于,内置函数的作用域是全局的,而 UDF 的作用域是 DB 内部。 所以如果当前链接 session 位于数据库 DB 内部时,直接使用 UDF 名字会在当前 DB 内部查找对应的 UDF。否则用户需要显示的指定 UDF 的数据库名字,例如 `dbName.funcName`。 @@ -368,11 +368,11 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, } ``` -2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上`_outer`后缀,其中带后缀`_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 +2. 在 Doris 中注册创建 Java-UDTF 函数。此时会注册两个 UTDF 函数,另外一个是在函数名后面加上 `_outer` 后缀,其中带后缀 `_outer` 的是针对结果为 0 行时的特殊处理,具体可查看[OUTER 组合器](../../sql-manual/sql-functions/table-functions/explode-numbers-outer.md)。 更多语法帮助可参阅 [CREATE FUNCTION](../../sql-manual/sql-statements/function/CREATE-FUNCTION). ```sql - CREATE TABLES FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( + CREATE TABLE FUNCTION java-utdf(string, string) RETURNS array<string> PROPERTIES ( "file"="file:///pathTo/java-udtf.jar", "symbol"="org.apache.doris.udf.demo.UDTFStringTest", "always_nullable"="true", @@ -408,7 +408,7 @@ UDTF 和 UDF 函数一样,需要用户自主实现一个 `evaluate` 方法, *解决方案 1:* -是可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 +可以将资源加载代码拆分开,单独生成一个 JAR 包文件,然后其他包直接引用该资源 JAR 包。 假设已经将代码拆分为了 DictLibrary 和 FunctionUdf 两个文件。 @@ -451,7 +451,7 @@ public class FunctionUdf { jar -cf ./DictLibrary.jar ./DictLibrary.class ``` -2. 编译 FunctionUdf 文件,需要引用上一步的到的资源包最为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 +2. 编译 FunctionUdf 文件,需要引用上一步得到的资源包作为库使用,这样打包后可以得到 UDF 的 FunctionUdf.jar 包。 ```shell javac -cp ./DictLibrary.jar ./FunctionUdf.java diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/window-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/window-function.md index 48647c68dad..7c7583d79b2 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/window-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/query-data/window-function.md @@ -1,6 +1,6 @@ --- { - "title": "分析函数 (窗口函数)", + "title": "分析函数(窗口函数)", "language": "zh-CN" } --- @@ -378,7 +378,7 @@ GROUP BY ## 报告函数 -报告函数是指每一行的窗口范围都是整个 Partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: +报告函数是指每一行的窗口范围都是整个 partition。报告函数的主要优点是能够在单个查询块中多次传递数据,从而提高查询性能。例如,“对于每一年,找出其销售额最高的商品类别”之类的查询,使用报告函数则不需要进行 JOIN 操作。示例如下: ```sql select year,category,total_sum from ( @@ -427,7 +427,7 @@ where total_sum=max_sales; 2 rows in set (0.12 sec) ``` -你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品。为例,查询语句如下: +你可以将报告聚合与嵌套查询结合使用,以解决一些复杂的问题,比如查找重要商品子类别中销量最好的产品。以“查找产品销售额占其产品类别总销售额 20% 以上的子类别,并从中选出其中销量最高的五种商品”为例,查询语句如下: ```sql select i_category as categ, i_class as sub_categ, i_item_id @@ -449,7 +449,7 @@ where sub_cat_sales>0.2*cat_sales and rank_in_line<=5; ## LAG / LEAD 函数 -LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,皆可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 +LAG 和 LEAD 函数适用于值之间的比较。两个函数无需进行自连接,均可以同时访问表中的多个行,从而可以提高查询处理的速度。具体来说,LAG 函数能够提供对当**前行之前**给定偏移处的行的访问,而 LEAD 函数则提供对当**前行之后**给定偏移处的行的访问。 以下是一个使用 LAG 函数的 SQL 查询示例,该查询希望选取特定年份(1999, 2000, 2001, 2002)中,每个商品类别的总销售额、前一年的总销售额以及两者之间的差异: diff --git a/versioned_docs/version-2.1/query-data/cte.md b/versioned_docs/version-2.1/query-data/cte.md index a3d87b474db..1f647212cd4 100644 --- a/versioned_docs/version-2.1/query-data/cte.md +++ b/versioned_docs/version-2.1/query-data/cte.md @@ -26,7 +26,7 @@ under the License. ## Description -Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTE are primarily used in SELECT statements. +Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTEs are primarily used in SELECT statements. To specify a CTE, use the `WITH` clause with one or more comma-separated clauses. Each clause provides a subquery that generates a result set and associates a name with the subquery. diff --git a/versioned_docs/version-2.1/query-data/lateral-view.md b/versioned_docs/version-2.1/query-data/lateral-view.md index 9f506efdcfa..65dd1eb2656 100644 --- a/versioned_docs/version-2.1/query-data/lateral-view.md +++ b/versioned_docs/version-2.1/query-data/lateral-view.md @@ -26,7 +26,7 @@ under the License. # Column to Row (Lateral View) -Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw output row. +Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw input row. ## Grammar @@ -46,7 +46,7 @@ LATERAL VIEW generator_function ( expression [, ...] ) table_identifier AS colu - column_identifier - List column alias `generator_function`, which can be used to output rows. The number of column identifiers must match the number of columns returned by the generator function. + List column alias `generator_function`, which can be used to reference the output columns. The number of column identifiers must match the number of columns returned by the generator function. ## Example diff --git a/versioned_docs/version-2.1/query-data/multi-dimensional-analytics.md b/versioned_docs/version-2.1/query-data/multi-dimensional-analytics.md index f07ac8ff9d8..021a49150b7 100644 --- a/versioned_docs/version-2.1/query-data/multi-dimensional-analytics.md +++ b/versioned_docs/version-2.1/query-data/multi-dimensional-analytics.md @@ -551,4 +551,4 @@ Using `CUBE` computes all possible aggregation levels (eight in this case), but ## APPENDIX -For table creation statements and data files, see the [Window Function](window-function.md) appendix. +For table creation statements and data files, see the [Window Function](window-function.md) appendix. \ No newline at end of file diff --git a/versioned_docs/version-2.1/query-data/mysql-compatibility.md b/versioned_docs/version-2.1/query-data/mysql-compatibility.md index f328c7caac8..165c6b2ff79 100644 --- a/versioned_docs/version-2.1/query-data/mysql-compatibility.md +++ b/versioned_docs/version-2.1/query-data/mysql-compatibility.md @@ -36,8 +36,8 @@ Doris is highly compatible with MySQL syntax and supports standard SQL. However, | Bit | <p>- Supported</p> <p>- Range: 1 to 64</p> | Not supported | | Tinyint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -128 to 127, unsigned range from 0 to 255 </p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -128 to 127</p> | | Smallint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p> - Range: signed range from -2^15 to 2^15-1, unsigned range from 0 to 2^16-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -32768 to 32767</p> | -| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to -2^24-1</p> | - Not supported | -| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to -2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | +| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to 2^24-1</p> | - Not supported | +| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to 2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | | Bigint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^63 to 2^63-1, unsigned range from 0 to 2^64-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^63 to 2^63-1</p> | | Largeint | - Not supported | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^127 to 2^127-1</p> | | Decimal | <p>- Supported</p> <p>- Supports signed and unsigned (deprecated after 8.0.17)</p> <p>- Default: Decimal(10, 0)</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Default: Decimal(9, 0)</p> | @@ -252,7 +252,7 @@ This syntax can only be used on the UNIQUE KEY model table. The DELETE syntax in Doris is basically the same as in MySQL. However, since Doris is an analytical database, deletions cannot be too frequent. -#### Select +#### SELECT ```sql SELECT diff --git a/versioned_docs/version-2.1/query-data/subquery.md b/versioned_docs/version-2.1/query-data/subquery.md index c70e55d4cd0..ddff0b8f53d 100644 --- a/versioned_docs/version-2.1/query-data/subquery.md +++ b/versioned_docs/version-2.1/query-data/subquery.md @@ -304,20 +304,20 @@ With this flag, the `where` filtering condition can be rewritten as `where mark_ ## Usage notes -Since the output of a scalar subquery must be a single value, Doris adopts different processing methods for correlated and non-correlated scalar subqueries. +Since the output of a scalar subquery must be a single value, a runtime error will be reported when the subquery returns more than one row of data. ### For Correlated Scalar Subqueries -Currently, Doris can only statically ensure that the subquery outputs a single value (i.e., a single aggregate function without `group by`). Therefore, when using correlated scalar subqueries, a `group by`-less aggregate function such as `any_value` needs to be added according to requirements, so that the optimizer can recognize the single-value semantics smoothly. Users need to ensure that the subquery always returns only one value. If the subquery actually returns multiple values (othe [...] +When using a correlated quantifier subquery, if the subquery that satisfies the correlation condition returns more than one row of data, a runtime error will be reported. Please refer to the following SQL example: ```sql --- Correlated scalar subquery lacking a single aggregate function without group by, currently not supported -select t1.*, (select t2.c1 from t2 where t1.c2 = t2.c2) from t1; - --- Add a single aggregate function for the optimizer to recognize smoothly -select t1.*, (select any_value(t2.c1) from t2 where t1.c2 = t2.c2) from t1; +-- If there are more than 1 row in the t2 table that satisfies t1.c2 = t2.c2 in the associated scalar subquery, a runtime error will be reported +select t1.*, (select t2.c1 from t2 where t1.c2 = t2.c2) from t1; + +-- Example error message +ERROR 1105 (HY000): errCode = 2, detailMessage = (127.0.0.1)[INVALID_ARGUMENT][E33] correlate scalar subquery must return only 1 row ``` ### For Non-Correlated Scalar Subqueries diff --git a/versioned_docs/version-2.1/query-data/udf/java-user-defined-function.md b/versioned_docs/version-2.1/query-data/udf/java-user-defined-function.md index 0402042d284..96931bb2621 100644 --- a/versioned_docs/version-2.1/query-data/udf/java-user-defined-function.md +++ b/versioned_docs/version-2.1/query-data/udf/java-user-defined-function.md @@ -540,4 +540,4 @@ mysql [test_query_qa]>select print_12(); +------------+ 1 row in set (0.04 sec) -``` +``` \ No newline at end of file diff --git a/versioned_docs/version-2.1/query-data/window-function.md b/versioned_docs/version-2.1/query-data/window-function.md index a071c2f3d11..5df4ab55ede 100644 --- a/versioned_docs/version-2.1/query-data/window-function.md +++ b/versioned_docs/version-2.1/query-data/window-function.md @@ -579,6 +579,7 @@ This results in a consistent query output: 3 rows in set (0.03 sec) ``` +For more information on analytic functions, refer to the Oracle official documentation [SQL for Analysis and Reporting](https://docs.oracle.com/en/database/oracle/oracle-database/23/dwhsg/sql-analysis-reporting-data-warehouses.html#GUID-20EFBF1E-F79D-4E4A-906C-6E496EECA684) ## Reference diff --git a/versioned_docs/version-3.0/query-data/cte.md b/versioned_docs/version-3.0/query-data/cte.md index a3d87b474db..1f647212cd4 100644 --- a/versioned_docs/version-3.0/query-data/cte.md +++ b/versioned_docs/version-3.0/query-data/cte.md @@ -26,7 +26,7 @@ under the License. ## Description -Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTE are primarily used in SELECT statements. +Common Table Expression (CTE) define a temporary result set that can be referenced multiple times within the scope of an SQL statement. CTEs are primarily used in SELECT statements. To specify a CTE, use the `WITH` clause with one or more comma-separated clauses. Each clause provides a subquery that generates a result set and associates a name with the subquery. diff --git a/versioned_docs/version-3.0/query-data/lateral-view.md b/versioned_docs/version-3.0/query-data/lateral-view.md index 9f506efdcfa..65dd1eb2656 100644 --- a/versioned_docs/version-3.0/query-data/lateral-view.md +++ b/versioned_docs/version-3.0/query-data/lateral-view.md @@ -26,7 +26,7 @@ under the License. # Column to Row (Lateral View) -Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw output row. +Used in conjunction with generator functions such as `EXPLODE`, will generate a virtual table containing one or more rows. `LATERAL VIEW` applies rows to each raw input row. ## Grammar @@ -46,7 +46,7 @@ LATERAL VIEW generator_function ( expression [, ...] ) table_identifier AS colu - column_identifier - List column alias `generator_function`, which can be used to output rows. The number of column identifiers must match the number of columns returned by the generator function. + List column alias `generator_function`, which can be used to reference the output columns. The number of column identifiers must match the number of columns returned by the generator function. ## Example diff --git a/versioned_docs/version-3.0/query-data/mysql-compatibility.md b/versioned_docs/version-3.0/query-data/mysql-compatibility.md index f328c7caac8..165c6b2ff79 100644 --- a/versioned_docs/version-3.0/query-data/mysql-compatibility.md +++ b/versioned_docs/version-3.0/query-data/mysql-compatibility.md @@ -36,8 +36,8 @@ Doris is highly compatible with MySQL syntax and supports standard SQL. However, | Bit | <p>- Supported</p> <p>- Range: 1 to 64</p> | Not supported | | Tinyint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -128 to 127, unsigned range from 0 to 255 </p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -128 to 127</p> | | Smallint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p> - Range: signed range from -2^15 to 2^15-1, unsigned range from 0 to 2^16-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -32768 to 32767</p> | -| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to -2^24-1</p> | - Not supported | -| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to -2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | +| Mediumint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^23 to 2^23-1, unsigned range from 0 to 2^24-1</p> | - Not supported | +| Int | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^31 to 2^31-1, unsigned range from 0 to 2^32-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2147483648 to 2147483647</p> | | Bigint | <p>- Supported</p> <p>- Supports signed and unsigned</p> <p>- Range: signed range from -2^63 to 2^63-1, unsigned range from 0 to 2^64-1</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^63 to 2^63-1</p> | | Largeint | - Not supported | <p>- Supported</p> <p>- Only supports signed</p> <p>- Range: -2^127 to 2^127-1</p> | | Decimal | <p>- Supported</p> <p>- Supports signed and unsigned (deprecated after 8.0.17)</p> <p>- Default: Decimal(10, 0)</p> | <p>- Supported</p> <p>- Only supports signed</p> <p>- Default: Decimal(9, 0)</p> | @@ -252,7 +252,7 @@ This syntax can only be used on the UNIQUE KEY model table. The DELETE syntax in Doris is basically the same as in MySQL. However, since Doris is an analytical database, deletions cannot be too frequent. -#### Select +#### SELECT ```sql SELECT diff --git a/versioned_docs/version-3.0/query-data/udf/java-user-defined-function.md b/versioned_docs/version-3.0/query-data/udf/java-user-defined-function.md index 0402042d284..96931bb2621 100644 --- a/versioned_docs/version-3.0/query-data/udf/java-user-defined-function.md +++ b/versioned_docs/version-3.0/query-data/udf/java-user-defined-function.md @@ -540,4 +540,4 @@ mysql [test_query_qa]>select print_12(); +------------+ 1 row in set (0.04 sec) -``` +``` \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org