Skip to content

Commit f079dc2

Browse files
authored
[doc](function) update all scalar bitmap functions doc (#2581)
update all scalar bitmap functions doc
1 parent f794c79 commit f079dc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1115
-479
lines changed

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,55 +24,55 @@ BITMAP_AND_COUNT(<bitmap>, <bitmap>,[, <bitmap>...])
2424
## Return Value
2525

2626
Returns an integer
27-
- If the parameter has a null value, it returns NULL
27+
- If the parameter has a NULL value, it returns 0
2828

2929
## Examples
3030

3131
```sql
32-
select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'));
32+
select bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')) as res;
3333
```
3434

3535
```text
36-
+----------------------------------------------------------------------------+
37-
| bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
38-
+----------------------------------------------------------------------------+
39-
| 1 |
40-
+----------------------------------------------------------------------------+
36+
+------+
37+
| res |
38+
+------+
39+
| 1 |
40+
+------+
4141
```
4242

4343
```sql
44-
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'));
44+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5')) as res;
4545
```
4646

4747
```text
48-
+-------------------------------------------------------------------------------------------------------------+
49-
| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) |
50-
+-------------------------------------------------------------------------------------------------------------+
51-
| 2 |
52-
+-------------------------------------------------------------------------------------------------------------+
48+
+------+
49+
| res |
50+
+------+
51+
| 2 |
52+
+------+
5353
```
5454

5555
```sql
56-
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty());
56+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty()) as res;
5757
```
5858

5959
```text
60-
+-----------------------------------------------------------------------------------------------------------------------------+
61-
| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), bitmap_empty())) |
62-
+-----------------------------------------------------------------------------------------------------------------------------+
63-
| 0 |
64-
+-----------------------------------------------------------------------------------------------------------------------------+
60+
+------+
61+
| res |
62+
+------+
63+
| 0 |
64+
+------+
6565
```
6666

6767
```sql
68-
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL);
68+
select bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL) as res;
6969
```
7070

7171
```text
72-
+-------------------------------------------------------------------------------------------------------------------+
73-
| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL)) |
74-
+-------------------------------------------------------------------------------------------------------------------+
75-
| NULL |
76-
+-------------------------------------------------------------------------------------------------------------------+
72+
+------+
73+
| res |
74+
+------+
75+
| 0 |
76+
+------+
7777
```
7878

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ BITMAP_AND_NOT_COUNT(<bitmap1>, <bitmap2>)
2929
## Return Value
3030

3131
Returns an integer.
32-
- If the parameter has a null value, returns NULL
32+
- If the parameter has a NULL value, returns 0
3333

3434
## Examples
3535

3636
```sql
37-
select bitmap_and_not_count(null, bitmap_from_string('1,2,3')) banc1, bitmap_and_not_count(bitmap_from_string('1,2,3') ,null) banc2;
37+
select bitmap_and_not_count(NULL, bitmap_from_string('1,2,3')) banc1, bitmap_and_not_count(bitmap_from_string('1,2,3'), NULL) banc2;
3838
```
3939

4040
```text

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BITMAP_AND_NOT(<bitmap1>, <bitmap2>)
2929
## Return Value
3030

3131
Returns a BITMAP.
32-
- If the parameter has a null value, returns NULL
32+
- If the parameter has a NULL value, returns NULL
3333

3434
## Examples
3535

@@ -46,37 +46,37 @@ select bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_strin
4646
```
4747

4848
```sql
49-
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')));
49+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'))) as cnt;
5050
```
5151

5252
```text
53-
+--------------------------------------------------------------------------------------------+
54-
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'))) |
55-
+--------------------------------------------------------------------------------------------+
56-
| 1,2 |
57-
+--------------------------------------------------------------------------------------------+
53+
+------+
54+
| cnt |
55+
+------+
56+
| 1,2 |
57+
+------+
5858
```
5959

6060
```sql
61-
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()));
61+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty())) cnt;
6262
```
6363

6464
```text
65-
+-------------------------------------------------------------------------------+
66-
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), bitmap_empty())) |
67-
+-------------------------------------------------------------------------------+
68-
| 1,2,3 |
69-
+-------------------------------------------------------------------------------+
65+
+-------+
66+
| cnt |
67+
+-------+
68+
| 1,2,3 |
69+
+-------+
7070
```
7171

7272
```sql
73-
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
73+
select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL)) as res;
7474
```
7575

7676
```text
77-
+---------------------------------------------------------------------+
78-
| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
79-
+---------------------------------------------------------------------+
80-
| NULL |
81-
+---------------------------------------------------------------------+
77+
+------+
78+
| res |
79+
+------+
80+
| NULL |
81+
+------+
8282
```

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,42 @@ BITMAP_AND(<bitmap>, <bitmap>,[, <bitmap>...])
2424
## Return Value
2525

2626
Returns a BITMAP
27-
- If the parameter has a null value, it returns NULL
27+
- If the parameter has a NULL value, it returns NULL
2828

2929
## Examples
3030

3131
```sql
32-
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5')));
32+
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) as res;
3333
```
3434

3535
```text
36-
+-----------------------------------------------------------------------------------------------------------------------+
37-
| bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) |
38-
+-----------------------------------------------------------------------------------------------------------------------+
39-
| 1,2 |
40-
+-----------------------------------------------------------------------------------------------------------------------+
36+
+------+
37+
| res |
38+
+------+
39+
| 1,2 |
40+
+------+
4141
```
4242

4343
```sql
44-
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty()));
44+
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),bitmap_empty())) as res;
4545
```
4646

4747
```text
48-
+---------------------------------------------------------------------------------------------------------------------------------------+
49-
| bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), bitmap_empty())) |
50-
+---------------------------------------------------------------------------------------------------------------------------------------+
51-
| |
52-
+---------------------------------------------------------------------------------------------------------------------------------------+
48+
+------+
49+
| res |
50+
+------+
51+
| |
52+
+------+
5353
```
5454

5555
```sql
56-
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),NULL));
56+
select bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'),NULL)) as res;
5757
```
5858

5959
```text
60-
+-----------------------------------------------------------------------------------------------------------------------------+
61-
| bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL)) |
62-
+-----------------------------------------------------------------------------------------------------------------------------+
63-
| NULL |
64-
+-----------------------------------------------------------------------------------------------------------------------------+
60+
+------+
61+
| res |
62+
+------+
63+
| NULL |
64+
+------+
6565
```

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ BITMAP_CONTAINS(<bitmap>, <bigint>)
2525
## Return Value
2626

2727
Returns a boolean
28-
- If the parameter is empty, returns NULL
28+
- If the parameter is NULL, returns NULL
2929

3030
## Examples
3131

@@ -41,3 +41,14 @@ select bitmap_contains(to_bitmap(1),2) cnt1, bitmap_contains(to_bitmap(1),1) cnt
4141
+------+------+
4242
```
4343

44+
```sql
45+
select bitmap_contains(NULL,2) cnt1, bitmap_contains(to_bitmap(1),NULL) cnt2;
46+
```
47+
48+
```text
49+
+------+------+
50+
| cnt1 | cnt2 |
51+
+------+------+
52+
| NULL | NULL |
53+
+------+------+
54+
```

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,15 @@ select bitmap_count(to_bitmap(1)) cnt;
3939
+------+
4040
```
4141

42+
```sql
43+
select bitmap_count(bitmap_empty()) cnt;
44+
```
45+
46+
```text
47+
+------+
48+
| cnt |
49+
+------+
50+
| 0 |
51+
+------+
52+
```
53+

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,29 @@ SELECT bitmap_to_string(bitmap_from_array(array(1, 0, 1, 1, 0, 1, 0))) AS bs;
3838
+------+
3939
| 0,1 |
4040
+------+
41+
```
42+
43+
44+
```sql
45+
SELECT bitmap_to_string(bitmap_from_array(NULL)) AS bs;
46+
```
47+
48+
```text
49+
+------+
50+
| bs |
51+
+------+
52+
| NULL |
53+
+------+
54+
```
55+
56+
```sql
57+
select bitmap_to_string(bitmap_from_array([1,2,3,-1]));
58+
```
59+
60+
```text
61+
+-------------------------------------------------+
62+
| bitmap_to_string(bitmap_from_array([1,2,3,-1])) |
63+
+-------------------------------------------------+
64+
| NULL |
65+
+-------------------------------------------------+
4166
```

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ Returns a BITMAP
2828

2929
## Examples
3030

31+
32+
```sql
33+
select bitmap_to_string(bitmap_from_base64("invalid")) bts;
34+
```
35+
36+
```text
37+
+------+
38+
| bts |
39+
+------+
40+
| NULL |
41+
+------+
42+
```
43+
3144
```sql
3245
select bitmap_to_string(bitmap_from_base64("AA==")) bts;
3346
```

docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,31 @@ select bitmap_to_string(bitmap_from_string("0, 1, 2")) bts;
4242
```
4343

4444
```sql
45-
select bitmap_from_string("-1, 0, 1, 2") bfs;
45+
select bitmap_to_string(bitmap_from_string("-1, 0, 1, 2")) bfs;
46+
```
47+
48+
```text
49+
+------+
50+
| bfs |
51+
+------+
52+
| NULL |
53+
+------+
54+
```
55+
56+
```sql
57+
select bitmap_to_string(bitmap_from_string(NULL)) bfs;
58+
```
59+
60+
```text
61+
+------+
62+
| bfs |
63+
+------+
64+
| NULL |
65+
+------+
66+
```
67+
68+
```sql
69+
select bitmap_to_string(bitmap_from_string("18446744073709551616, 1")) bfs;
4670
```
4771

4872
```text

0 commit comments

Comments
 (0)