Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb
{
"title": "BITMAP_INTERSECT",
"language": "zh-CN",
Expand All @@ -9,13 +9,13 @@
## 描述

聚合函数,用于计算分组后的 bitmap 交集。常见使用场景如:计算用户留存率。

Check notice on line 12 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-parameters-table

Parameters section must be a Markdown table with Parameter and Description columns. Owner%3A @zclllyybb
## 语法

```sql
BITMAP_INTERSECT(BITMAP <value>)
```

Check notice on line 18 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-return-null

Return Value section must document NULL return conditions%2C including when the function never returns NULL. Owner%3A @zclllyybb
## 参数

| 参数 | 说明 |
Expand All @@ -28,15 +28,33 @@

## 举例

```sql
-- setup
CREATE TABLE user_tags (
tag VARCHAR(20),
date DATETIME,
user_id BITMAP bitmap_union
) AGGREGATE KEY(tag, date) DISTRIBUTED BY HASH(tag) BUCKETS 1
PROPERTIES ("replication_num" = "1");
INSERT INTO user_tags VALUES
('A', '2020-05-18', to_bitmap(1)),
('A', '2020-05-18', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(3)),
('B', '2020-05-18', to_bitmap(4)),

Check warning on line 44 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
('B', '2020-05-19', to_bitmap(4)),
('B', '2020-05-19', to_bitmap(5));
```

表结构

Check warning on line 50 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
```
KeysType: AGG_KEY
Columns: tag varchar, date datetime, user_id bitmap bitmap_union

```

```

Check warning on line 57 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
求今天和昨天不同 tag 下的用户留存
select tag, bitmap_intersect(user_id) from (select tag, date, bitmap_union(user_id) user_id from table where date in ('2020-05-18', '2020-05-19') group by tag, date) a group by tag;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/corr.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb
{
"title": "CORR",
"language": "zh-CN",
Expand All @@ -9,7 +9,7 @@
## 描述

计算两个随机变量的皮尔逊系数

Check notice on line 12 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/corr.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-parameters-table

Parameters section must be a Markdown table with Parameter and Description columns. Owner%3A @zclllyybb
## 语法

```sql
Expand All @@ -32,6 +32,27 @@

## 举例

```sql
-- setup
create table test_corr(
id int,
k1 double,
k2 double
) distributed by hash (id) buckets 1
properties ("replication_num"="1");

insert into test_corr values
(1, 20, 22),
(1, 10, 20),
(2, 36, 21),
(2, 30, 22),
(2, 25, 20),
(3, 25, NULL),
(4, 25, 21),
(4, 25, 22),
(4, 25, 20);
```

```sql
select * from test_corr;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/count.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb
{
"title": "COUNT",
"language": "zh-CN",
Expand All @@ -11,7 +11,7 @@
返回指定列的非 NULL 记录数,或者记录总数

## 语法

Check notice on line 14 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/count.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-parameters-table

Parameters section must be a Markdown table with Parameter and Description columns. Owner%3A @zclllyybb
```sql
COUNT(DISTINCT <expr> [,<expr>,...])
COUNT(*)
Expand All @@ -30,6 +30,39 @@

## 举例

```sql
-- setup
create table test_count(
id int,
name varchar(20),
sex int
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into test_count values
(1, '1', 1),
(2, '2', 1),
(3, '3', 1),
(4, '0', 1),
(4, '4', 1),
(5, NULL, 1);

create table test_insert(
id int,
name varchar(20),
sex int
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into test_insert values
(1, '1', 1),
(2, '2', 1),
(3, '3', 1),
(4, '0', 1),
(4, '4', 1),
(5, NULL, 1);
```

```sql
select * from test_count;
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---

Check notice on line 1 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/covar-samp.md

View workflow job for this annotation

GitHub Actions / Build Check

sql-function-section-order

SQL function docs must contain sections in this order%3A Description%2C Syntax%2C Parameters%2C Return Value%2C Example. Missing%3A Example. Owner%3A @zclllyybb
{
"title": "COVAR_SAMP",
"language": "zh-CN",
Expand Down Expand Up @@ -31,6 +31,23 @@

## 举例

```sql
-- setup
create table baseall(
id int,
x double,
y double
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into baseall values
(1, 1.0, 2.0),

Check warning on line 44 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/covar-samp.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
(2, 2.0, 3.0),
(3, 3.0, 4.0),
(4, 4.0, NULL),
(5, NULL, 5.0);
```

```
select covar_samp(x,y) from baseall;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@

## 举例

```sql
-- setup
create table baseall(
id int,
x double,
y double
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into baseall values
(1, 1.0, 2.0),

Check warning on line 48 in i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/aggregate-functions/covar.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
(2, 2.0, 3.0),
(3, 3.0, 4.0),
(4, 4.0, NULL),
(5, NULL, 5.0);
```

```
select covar(x,y) from baseall;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ GROUP_CONCAT([DISTINCT] <str>[, <sep>] [ORDER BY { <col_name> | <expr>} [ASC | D

## 举例

```sql
-- setup
create table test(
value varchar(10)
) distributed by hash(value) buckets 1
properties ("replication_num"="1");

insert into test values
("a"),
("b"),
("c"),
("c");
```

```sql
select value from test;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,33 @@

## 举例

```sql
-- setup
CREATE TABLE user_tags (
tag VARCHAR(20),
date DATETIME,
user_id BITMAP bitmap_union
) AGGREGATE KEY(tag, date) DISTRIBUTED BY HASH(tag) BUCKETS 1
PROPERTIES ("replication_num" = "1");
INSERT INTO user_tags VALUES
('A', '2020-05-18', to_bitmap(1)),
('A', '2020-05-18', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(3)),
('B', '2020-05-18', to_bitmap(4)),

Check warning on line 44 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
('B', '2020-05-19', to_bitmap(4)),
('B', '2020-05-19', to_bitmap(5));
```

表结构

Check warning on line 50 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
```
KeysType: AGG_KEY
Columns: tag varchar, date datetime, user_id bitmap bitmap_union

```

```

Check warning on line 57 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/bitmap-intersect.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
求今天和昨天不同 tag 下的用户留存
select tag, bitmap_intersect(user_id) from (select tag, date, bitmap_union(user_id) user_id from table where date in ('2020-05-18', '2020-05-19') group by tag, date) a group by tag;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## 描述

采用 [Welford](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm) 算法计算两个随机变量的皮尔逊系数,能够有效降低计算误差。

Check notice on line 11 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/corr-welford.md

View workflow job for this annotation

GitHub Actions / Build Check

link-external-report-only

External link is report-only and was not fetched%3A https%3A//en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm. Owner%3A @zclllyybb

## 语法

Expand All @@ -32,6 +32,27 @@

## 举例

```sql
-- setup
create table test_corr(
id int,
k1 double,
k2 double
) distributed by hash (id) buckets 1
properties ("replication_num"="1");

insert into test_corr values
(1, 20, 22),
(1, 10, 20),
(2, 36, 21),
(2, 30, 22),
(2, 25, 20),
(3, 25, NULL),
(4, 25, 21),
(4, 25, 22),
(4, 25, 20);
```

```sql
select * from test_corr;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,27 @@ CORR(<expr1>, <expr2>)

## 举例

```sql
-- setup
create table test_corr(
id int,
k1 double,
k2 double
) distributed by hash (id) buckets 1
properties ("replication_num"="1");

insert into test_corr values
(1, 20, 22),
(1, 10, 20),
(2, 36, 21),
(2, 30, 22),
(2, 25, 20),
(3, 25, NULL),
(4, 25, 21),
(4, 25, 22),
(4, 25, 20);
```

```sql
select * from test_corr;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,39 @@ COUNT(<expr>)

## 举例

```sql
-- setup
create table test_count(
id int,
name varchar(20),
sex int
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into test_count values
(1, '1', 1),
(2, '2', 1),
(3, '3', 1),
(4, '0', 1),
(4, '4', 1),
(5, NULL, 1);

create table test_insert(
id int,
name varchar(20),
sex int
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into test_insert values
(1, '1', 1),
(2, '2', 1),
(3, '3', 1),
(4, '0', 1),
(4, '4', 1),
(5, NULL, 1);
```

```sql
select * from test_count;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@

## 举例

```sql
-- setup
create table baseall(
id int,
x double,
y double
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into baseall values
(1, 1.0, 2.0),

Check warning on line 44 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/covar-samp.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
(2, 2.0, 3.0),
(3, 3.0, 4.0),
(4, 4.0, NULL),
(5, NULL, 5.0);
```

```
select covar_samp(x,y) from baseall;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@

## 举例

```sql
-- setup
create table baseall(
id int,
x double,
y double
) distributed by hash(id) buckets 1
properties ("replication_num"="1");

insert into baseall values
(1, 1.0, 2.0),

Check warning on line 48 in i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x/sql-manual/sql-functions/aggregate-functions/covar.md

View workflow job for this annotation

GitHub Actions / Build Check

markdown-code-fence-language

Code fence should declare a language. Owner%3A @zclllyybb
(2, 2.0, 3.0),
(3, 3.0, 4.0),
(4, 4.0, NULL),
(5, NULL, 5.0);
```

```
select covar(x,y) from baseall;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ GROUP_CONCAT([DISTINCT] <str>[, <sep>] [ORDER BY { <col_name> | <expr>} [ASC | D

## 举例

```sql
-- setup
create table test(
value varchar(10)
) distributed by hash(value) buckets 1
properties ("replication_num"="1");

insert into test values
("a"),
("b"),
("c"),
("c");
```

```sql
select value from test;
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ The data type of the return value is BITMAP.

## Example

```sql
-- setup
CREATE TABLE user_tags (
tag VARCHAR(20),
date DATETIME,
user_id BITMAP bitmap_union
) AGGREGATE KEY(tag, date) DISTRIBUTED BY HASH(tag) BUCKETS 1
PROPERTIES ("replication_num" = "1");
INSERT INTO user_tags VALUES
('A', '2020-05-18', to_bitmap(1)),
('A', '2020-05-18', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(2)),
('A', '2020-05-19', to_bitmap(3)),
('B', '2020-05-18', to_bitmap(4)),
('B', '2020-05-19', to_bitmap(4)),
('B', '2020-05-19', to_bitmap(5));
```

Table schema

```
Expand Down
Loading
Loading