This is an automated email from the ASF dual-hosted git repository.
zhangstar333 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 f079dc271d0 [doc](function) update all scalar bitmap functions doc
(#2581)
f079dc271d0 is described below
commit f079dc271d09da81af7782500e7431dde7c5def2
Author: zhangstar333 <[email protected]>
AuthorDate: Fri Jul 18 14:41:07 2025 +0800
[doc](function) update all scalar bitmap functions doc (#2581)
update all scalar bitmap functions doc
---
.../bitmap-functions/bitmap-and-count.md | 50 +++++++--------
.../bitmap-functions/bitmap-and-not-count.md | 4 +-
.../bitmap-functions/bitmap-and-not.md | 38 +++++------
.../bitmap-functions/bitmap-and.md | 38 +++++------
.../bitmap-functions/bitmap-contains.md | 13 +++-
.../bitmap-functions/bitmap-count.md | 12 ++++
.../bitmap-functions/bitmap-from-array.md | 25 ++++++++
.../bitmap-functions/bitmap-from-base64.md | 13 ++++
.../bitmap-functions/bitmap-from-string.md | 26 +++++++-
.../bitmap-functions/bitmap-has-all.md | 40 ++++++++----
.../bitmap-functions/bitmap-has-any.md | 37 +++++++----
.../bitmap-functions/bitmap-hash.md | 15 +++++
.../bitmap-functions/bitmap-hash64.md | 15 +++++
.../bitmap-functions/bitmap-max.md | 16 ++++-
.../bitmap-functions/bitmap-min.md | 16 ++++-
.../bitmap-functions/bitmap-not.md | 39 ++++++++----
.../bitmap-functions/bitmap-or-count.md | 61 +++++++++---------
.../scalar-functions/bitmap-functions/bitmap-or.md | 60 +++++++++---------
.../bitmap-functions/bitmap-subset-in-range.md | 32 ++++++++++
.../bitmap-functions/bitmap-subset-limit.md | 44 +++++++++++++
.../bitmap-functions/bitmap-xor-count.md | 72 ++++++++++-----------
.../bitmap-functions/bitmap-xor.md | 49 +++++++-------
.../bitmap-functions/sub-bitmap.md | 18 +++++-
.../scalar-functions/bitmap-functions/to-bitmap.md | 71 +++++++++++++++++----
.../bitmap-functions/bitmap-and-count.md | 50 +++++++--------
.../bitmap-functions/bitmap-and-not-count.md | 4 +-
.../bitmap-functions/bitmap-and-not.md | 38 +++++------
.../bitmap-functions/bitmap-and.md | 38 +++++------
.../bitmap-functions/bitmap-contains.md | 14 +++-
.../bitmap-functions/bitmap-count.md | 12 ++++
.../bitmap-functions/bitmap-from-array.md | 23 +++++++
.../bitmap-functions/bitmap-from-base64.md | 12 ++++
.../bitmap-functions/bitmap-from-string.md | 26 +++++++-
.../bitmap-functions/bitmap-has-all.md | 39 ++++++++----
.../bitmap-functions/bitmap-has-any.md | 39 ++++++++----
.../bitmap-functions/bitmap-hash.md | 16 +++++
.../bitmap-functions/bitmap-hash64.md | 15 +++++
.../bitmap-functions/bitmap-max.md | 16 ++++-
.../bitmap-functions/bitmap-min.md | 16 ++++-
.../bitmap-functions/bitmap-not.md | 39 ++++++++----
.../bitmap-functions/bitmap-or-count.md | 61 +++++++++---------
.../scalar-functions/bitmap-functions/bitmap-or.md | 36 +++++------
.../bitmap-functions/bitmap-subset-in-range.md | 32 ++++++++++
.../bitmap-functions/bitmap-subset-limit.md | 43 +++++++++++++
.../bitmap-functions/bitmap-xor-count.md | 74 +++++++++++-----------
.../bitmap-functions/bitmap-xor.md | 49 +++++++-------
.../bitmap-functions/sub-bitmap.md | 25 ++++++--
.../scalar-functions/bitmap-functions/to-bitmap.md | 73 +++++++++++++++++----
48 files changed, 1115 insertions(+), 479 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
index 09facec6a86..7d1caf772c0 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
@@ -24,55 +24,55 @@ BITMAP_AND_COUNT(<bitmap>, <bitmap>,[, <bitmap>...])
## Return Value
Returns an integer
-- If the parameter has a null value, it returns NULL
+- If the parameter has a NULL value, it returns 0
## Examples
```sql
-select
bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'));
+select
bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')) as
res;
```
```text
-+----------------------------------------------------------------------------+
-| bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+----------------------------------------------------------------------------+
-| 1 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
```
```sql
-select bitmap_and_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'));
+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;
```
```text
-+-------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) |
-+-------------------------------------------------------------------------------------------------------------+
-|
2 |
-+-------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 2 |
++------+
```
```sql
-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());
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'), bitmap_empty())) |
-+-----------------------------------------------------------------------------------------------------------------------------+
-|
0 |
-+-----------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
```sql
-select bitmap_and_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL);
+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;
```
```text
-+-------------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'), NULL)) |
-+-------------------------------------------------------------------------------------------------------------------+
-|
NULL |
-+-------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
index 3cb15534ee3..5230c2e5028 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
@@ -29,12 +29,12 @@ BITMAP_AND_NOT_COUNT(<bitmap1>, <bitmap2>)
## Return Value
Returns an integer.
-- If the parameter has a null value, returns NULL
+- If the parameter has a NULL value, returns 0
## Examples
```sql
-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;
+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;
```
```text
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
index 0e353098109..c0b5f89bdae 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
@@ -29,7 +29,7 @@ BITMAP_AND_NOT(<bitmap1>, <bitmap2>)
## Return Value
Returns a BITMAP.
-- If the parameter has a null value, returns NULL
+- If the parameter has a NULL value, returns NULL
## Examples
@@ -46,37 +46,37 @@ select
bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_strin
```
```sql
-select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')));
+select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')))
as cnt;
```
```text
-+--------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'))) |
-+--------------------------------------------------------------------------------------------+
-| 1,2
|
-+--------------------------------------------------------------------------------------------+
++------+
+| cnt |
++------+
+| 1,2 |
++------+
```
```sql
-select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()));
+select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()))
cnt;
```
```text
-+-------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),
bitmap_empty())) |
-+-------------------------------------------------------------------------------+
-| 1,2,3
|
-+-------------------------------------------------------------------------------+
++-------+
+| cnt |
++-------+
+| 1,2,3 |
++-------+
```
```sql
-select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
+select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL)) as
res;
```
```text
-+---------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
-+---------------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
index 76258de7367..d13b60af0ab 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
@@ -24,42 +24,42 @@ BITMAP_AND(<bitmap>, <bitmap>,[, <bitmap>...])
## Return Value
Returns a BITMAP
-- If the parameter has a null value, it returns NULL
+- If the parameter has a NULL value, it returns NULL
## Examples
```sql
-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')));
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) |
-+-----------------------------------------------------------------------------------------------------------------------+
-| 1,2
|
-+-----------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1,2 |
++------+
```
```sql
-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()));
+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;
```
```text
-+---------------------------------------------------------------------------------------------------------------------------------------+
-| 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())) |
-+---------------------------------------------------------------------------------------------------------------------------------------+
-|
|
-+---------------------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| |
++------+
```
```sql
-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));
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------------+
-| 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)) |
-+-----------------------------------------------------------------------------------------------------------------------------+
-| NULL
|
-+-----------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
index ab29642cbe4..01171e491ef 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
@@ -25,7 +25,7 @@ BITMAP_CONTAINS(<bitmap>, <bigint>)
## Return Value
Returns a boolean
-- If the parameter is empty, returns NULL
+- If the parameter is NULL, returns NULL
## Examples
@@ -41,3 +41,14 @@ select bitmap_contains(to_bitmap(1),2) cnt1,
bitmap_contains(to_bitmap(1),1) cnt
+------+------+
```
+```sql
+select bitmap_contains(NULL,2) cnt1, bitmap_contains(to_bitmap(1),NULL) cnt2;
+```
+
+```text
++------+------+
+| cnt1 | cnt2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
index 2d33b824de9..7718b8c6a59 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
@@ -39,3 +39,15 @@ select bitmap_count(to_bitmap(1)) cnt;
+------+
```
+```sql
+select bitmap_count(bitmap_empty()) cnt;
+```
+
+```text
++------+
+| cnt |
++------+
+| 0 |
++------+
+```
+
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
index fb9060a4d9b..5a4556df33e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
@@ -38,4 +38,29 @@ SELECT bitmap_to_string(bitmap_from_array(array(1, 0, 1, 1,
0, 1, 0))) AS bs;
+------+
| 0,1 |
+------+
+```
+
+
+```sql
+SELECT bitmap_to_string(bitmap_from_array(NULL)) AS bs;
+```
+
+```text
++------+
+| bs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_array([1,2,3,-1]));
+```
+
+```text
++-------------------------------------------------+
+| bitmap_to_string(bitmap_from_array([1,2,3,-1])) |
++-------------------------------------------------+
+| NULL |
++-------------------------------------------------+
```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
index 3f415a4eadf..204b930127b 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
@@ -28,6 +28,19 @@ Returns a BITMAP
## Examples
+
+```sql
+select bitmap_to_string(bitmap_from_base64("invalid")) bts;
+```
+
+```text
++------+
+| bts |
++------+
+| NULL |
++------+
+```
+
```sql
select bitmap_to_string(bitmap_from_base64("AA==")) bts;
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
index eb980b9f225..876ac2dc41c 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
@@ -42,7 +42,31 @@ select bitmap_to_string(bitmap_from_string("0, 1, 2")) bts;
```
```sql
-select bitmap_from_string("-1, 0, 1, 2") bfs;
+select bitmap_to_string(bitmap_from_string("-1, 0, 1, 2")) bfs;
+```
+
+```text
++------+
+| bfs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_string(NULL)) bfs;
+```
+
+```text
++------+
+| bfs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_string("18446744073709551616, 1")) bfs;
```
```text
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
index 84e7e8b40fb..d7f3ee59617 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
@@ -27,37 +27,53 @@ BITMAP_HAS_ALL(<bitmap1>, <bitmap2>)
Returns `true` if `<bitmap1>` contains all the elements of `<bitmap2>`;
Returns `true` if `<bitmap2>` contains no elements;
Otherwise, returns `false`.
+- If the parameter has a NULL value, it returns NULL
## Examples
To check if one Bitmap contains all elements of another Bitmap:
```sql
-select bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1,
2'));
+select bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1,
2')) as res;
```
The result will be:
```text
-+---------------------------------------------------------------------------+
-| bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1, 2')) |
-+---------------------------------------------------------------------------+
-| 1 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
```
To check if an empty Bitmap contains all elements of another Bitmap:
```sql
-select bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2'));
+select bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2')) as res;
```
The result will be:
```text
-+------------------------------------------------------------+
-| bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2')) |
-+------------------------------------------------------------+
-| 0 |
-+------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
+```
+
+
+```sql
+select bitmap_has_all(bitmap_empty(), NULL) as res;
+```
+
+The result will be:
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
index 2c50b01ae58..43500d110ce 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
@@ -26,29 +26,42 @@ BITMAP_HAS_ANY(<bitmap1>, <bitmap2>)
Returns true if the two Bitmaps have any common elements;
Returns false if the two Bitmaps do not have any common elements.
+- If the parameter has a NULL value, it returns NULL
## Examples
```sql
-mysql> select bitmap_has_any(to_bitmap(1), to_bitmap(2));
+select bitmap_has_any(to_bitmap(1), to_bitmap(2)) res;
```
```text
-+--------------------------------------------+
-| bitmap_has_any(to_bitmap(1), to_bitmap(2)) |
-+--------------------------------------------+
-| 0 |
-+--------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
```sql
-mysql> select bitmap_has_any(to_bitmap(1), to_bitmap(1));
+select bitmap_has_any(bitmap_from_string('1,2,3'), to_bitmap(1)) res;
```
```text
-+--------------------------------------------+
-| bitmap_has_any(to_bitmap(1), to_bitmap(1)) |
-+--------------------------------------------+
-| 1 |
-+--------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
+```
+
+```sql
+select bitmap_has_any(bitmap_from_string('1,2,3'), NULL) as res;
+```
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
index 79a5a3b8dca..3b58065c641 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
@@ -24,6 +24,7 @@ BITMAP_HASH(<expr>)
## Return Value
Returns a Bitmap containing the 32-bit hash value of the parameter `<expr>`.
+- If the parameter has a NULL value, it returns Empty Bitmap
::: note
@@ -66,3 +67,17 @@ The result will be:
| 33263478 |
+-------------------------------------------------+
```
+
+```sql
+select bitmap_to_string(bitmap_hash(NULL));
+```
+
+The result will be:
+
+```text
++------+
+| res |
++------+
+| |
++------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
index 4d4311542bd..29ac074dfc6 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
@@ -24,6 +24,7 @@ BITMAP_HASH64(<expr>)
## Return Value
Returns a Bitmap containing the 64-bit hash value of the parameter `<expr>`.
+- If the parameter has a NULL value, it returns Empty Bitmap
## Examples
@@ -41,4 +42,18 @@ The result will be:
+------------------------------------------+
| 15231136565543391023 |
+------------------------------------------+
+```
+
+```sql
+select bitmap_to_string(bitmap_hash64(NULL));
+```
+
+The result will be:
+
+```text
++---------------------------------------+
+| bitmap_to_string(bitmap_hash64(NULL)) |
++---------------------------------------+
+| |
++---------------------------------------+
```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
index 0ec1acd067f..1b79f523d8e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
@@ -24,7 +24,7 @@ BITMAP_MAX(<bitmap>)
## Return Value
The maximum value in the Bitmap.
-Returns `NULL` if the Bitmap is empty.
+Returns `NULL` if the Bitmap is empty or NULL value.
## Examples
@@ -59,3 +59,17 @@ The result will be:
| 9999999999 |
+------------+
```
+
+```sql
+select bitmap_max(bitmap_empty()) res1, bitmap_max(NULL) res2;
+```
+
+The result will be:
+
+```text
++------+------+
+| res1 | res2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
index a2efae4519c..1993a5f486e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
@@ -24,7 +24,7 @@ BITMAP_MIN(<bitmap>)
## Return Value
The minimum value in the Bitmap.
-Returns `NULL` if the Bitmap is empty.
+Returns `NULL` if the Bitmap is empty or is NULL value.
## Examples
@@ -59,3 +59,17 @@ The result will be:
| 1 |
+-------+
```
+
+```sql
+select bitmap_min(bitmap_empty()) res1,bitmap_min(NULL) res2;
+```
+
+The result will be:
+
+```text
++------+------+
+| res1 | res2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
index cd340667fc1..5486239f75e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
@@ -25,39 +25,50 @@ BITMAP_NOT(<bitmap1>, <bitmap2>)
## Return Value
A Bitmap representing the elements in `<bitmap1>` that are not in `<bitmap2>`.
+- If the parameter has a NULL value, it returns NULL
## Examples
To compute the difference between two Bitmaps:
```sql
-select bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) as res;
```
The result will be an empty Bitmap, as all elements in `<bitmap1>` are also in
`<bitmap2>`:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-|
|
-+----------------------------------------------------------------------------------------+
-1 row in set (0.01 sec)
++------+
+| res |
++------+
+| |
++------+
```
To compute the difference where `<bitmap1>` has elements not present in
`<bitmap2>`:
```sql
-select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4'))) as res;
```
The result will be a Bitmap containing the element `5`:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-| 5
|
-+----------------------------------------------------------------------------------------+
-1 row in set (0.01 sec)
++------+
+| res |
++------+
+| 5 |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'), NULL)) as res;
+```
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
index 204ffc58446..8dec95416b4 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
@@ -27,86 +27,85 @@ BITMAP_OR_COUNT(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## Return Value
The count of elements in the union of multiple Bitmaps.
-Returns `NULL` if any of the Bitmaps is `NULL`.
## Examples
To compute the count of elements in the union of a non-empty Bitmap and an
empty Bitmap:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty());
+select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty()) res;
```
The result will be:
```text
-+--------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty()) |
-+--------------------------------------------------------------+
-| 3 |
-+--------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
To compute the count of elements in the union of two identical Bitmaps:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3'));
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3')) res;
```
The result will be:
```text
-+---------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
-+---------------------------------------------------------------------------+
-| 3 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
To compute the count of elements in the union of two different Bitmaps:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'));
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5')) res;
```
The result will be:
```text
-+---------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+---------------------------------------------------------------------------+
-| 5 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 5 |
++------+
```
To compute the count of elements in the union of multiple Bitmaps, including
an empty Bitmap:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty());
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty()) res;
```
The result will be:
```text
-+-----------------------------------------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'),
to_bitmap(100), bitmap_empty()) |
-+-----------------------------------------------------------------------------------------------------------+
-|
6 |
-+-----------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
To compute the count of elements in the union of multiple Bitmaps, including a
`NULL` value:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), NULL);
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), NULL) res;
```
The result will be:
```text
-+-------------------------------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'),
to_bitmap(100), NULL) |
-+-------------------------------------------------------------------------------------------------+
-|
NULL |
-+-------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
index e4e3b9dd60d..f7292188586 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
@@ -49,17 +49,17 @@ The result will be:
To convert the union of two identical Bitmaps to a string:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(1)));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(1))) as res;
```
The result will be:
```text
-+---------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(1))) |
-+---------------------------------------------------------+
-| 1 |
-+---------------------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
```
To compute the union of two different Bitmaps:
@@ -81,63 +81,63 @@ The result will be:
To convert the union of two different Bitmaps to a string:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2)));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2))) res;
```
The result will be:
```text
-+---------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2))) |
-+---------------------------------------------------------+
-| 1,2 |
-+---------------------------------------------------------+
++------+
+| res |
++------+
+| 1,2 |
++------+
```
To compute the union of multiple Bitmaps, including a `NULL` value:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL)) res;
```
The result will be:
```text
-+--------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL)) |
-+--------------------------------------------------------------------------------------------+
-| 0,1,2,10
|
-+--------------------------------------------------------------------------------------------+
++----------+
+| res |
++----------+
+| 0,1,2,10 |
++----------+
```
To compute the union of multiple Bitmaps, including an empty Bitmap:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty()));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty())) res;
```
The result will be:
```text
-+------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty())) |
-+------------------------------------------------------------------------------------------------------+
-| 0,1,2,10
|
-+------------------------------------------------------------------------------------------------------+
++----------+
+| res |
++----------+
+| 0,1,2,10 |
++----------+
```
To compute the union of Bitmaps created from strings and individual values:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5')));
+select bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) res;
```
The result will be:
```text
-+--------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) |
-+--------------------------------------------------------------------------------------------------------+
-| 1,2,3,4,5,10
|
-+--------------------------------------------------------------------------------------------------------+
++--------------+
+| res |
++--------------+
+| 1,2,3,4,5,10 |
++--------------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
index fbc89d82840..ed3ba899ec1 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
@@ -26,6 +26,7 @@ BITMAP_SUBSET_IN_RANGE(<bitmap>, <range_start_include>,
<range_end_exclude>)
## Return Value
A subset Bitmap within the specified range.
+- If the parameter has a NULL value or invalid range, it returns NULL
## Examples
@@ -60,3 +61,34 @@ The result will be:
| 2 |
+-------+
```
+
+
+```sql
+select
bitmap_to_string(bitmap_subset_in_range(bitmap_from_string('1,2,3,4,5'), 2,
NULL)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+
+```sql
+select
bitmap_to_string(bitmap_subset_in_range(bitmap_from_string('1,2,3,4,5'), 2,
-10000)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
index 9e35c747c9d..e792f04abc8 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
@@ -26,6 +26,7 @@ BITMAP_SUBSET_LIMIT(<bitmap>, <position>, <cardinality_limit>)
## Return Value
A subset Bitmap within the specified range and limit.
+- If the parameter has a NULL value or invalid value, it returns NULL
## Examples
@@ -60,3 +61,46 @@ The result will be:
| 4,5 |
+-------+
```
+
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
4, NULL)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
-4, 3)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
4, -3)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
index 8c13f2cc7b5..e969aebc47d 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
@@ -27,72 +27,72 @@ BITMAP_XOR_COUNT(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## Return Value
The count of elements in the Bitmap resulting from the XOR operation of
multiple Bitmaps.
-Returns `NULL` if any of the input Bitmap parameters is `NULL`.
+Returns 0 if any of the input Bitmap parameters is `NULL`.
## Examples
To compute the count of elements in the symmetric difference of two Bitmaps:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5')) res;
```
The result will be:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+----------------------------------------------------------------------------+
-| 4 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 4 |
++------+
```
To compute the count of elements in the symmetric difference of two identical
Bitmaps:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3')) res;
```
The result will be:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
-+----------------------------------------------------------------------------+
-| 0 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
To compute the count of elements in the symmetric difference of two different
Bitmaps:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('4,5,6'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('4,5,6')) res;
```
The result will be:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('4,5,6')) |
-+----------------------------------------------------------------------------+
-| 6 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
To compute the count of elements in the symmetric difference of three Bitmaps:
```sql
-select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'));
+select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5')) res;
```
The result will be:
```text
-+-----------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5')) |
-+-----------------------------------------------------------------------------------------------------------+
-|
3 |
-+-----------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
To compute the count of elements in the symmetric difference of multiple
Bitmaps, including an empty Bitmap:
@@ -104,25 +104,25 @@ select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4')
The result will be:
```text
-+---------------------------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5'), bitmap_empty()) |
-+---------------------------------------------------------------------------------------------------------------------------+
-|
3 |
-+---------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
To compute the count of elements in the symmetric difference of multiple
Bitmaps, including a `NULL` value:
```sql
-select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL);
+select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL) res;
```
The result will be:
```text
-+-----------------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5'), NULL) |
-+-----------------------------------------------------------------------------------------------------------------+
-|
NULL |
-+-----------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
index f516035ae99..d8151e9eabc 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
@@ -27,6 +27,7 @@ BITMAP_XOR(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## Return Value
A Bitmap representing the symmetric difference of multiple Bitmaps.
+- If the parameter has a NULL value, it returns NULL
## Examples
@@ -49,63 +50,63 @@ The result will be:
To convert the symmetric difference of two Bitmaps to a string:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) res;
```
The result will be:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-| 1,4
|
-+----------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1,4 |
++------+
```
To compute the symmetric difference of three Bitmaps:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5')));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'))) res;
```
The result will be:
```text
-+---------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'))) |
-+---------------------------------------------------------------------------------------------------------------------+
-| 1,3,5
|
-+---------------------------------------------------------------------------------------------------------------------+
++-------+
+| res |
++-------+
+| 1,3,5 |
++-------+
```
To compute the symmetric difference of multiple Bitmaps, including an empty
Bitmap:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty()));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty()))
res;
```
The result will be:
```text
-+-------------------------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty())) |
-+-------------------------------------------------------------------------------------------------------------------------------------+
-| 1,3,5
|
-+-------------------------------------------------------------------------------------------------------------------------------------+
++-------+
+| res |
++-------+
+| 1,3,5 |
++-------+
```
To compute the symmetric difference of multiple Bitmaps, including a `NULL`
value:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL)) res;
```
The result will be:
```text
-+---------------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL)) |
-+---------------------------------------------------------------------------------------------------------------------------+
-| NULL
|
-+---------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
index 1edafa85bf3..04e934bbfcf 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
@@ -20,12 +20,14 @@ SUB_BITMAP(<bitmap>, <position>, <cardinality_limit>)
| Parameter | Description |
|-----------------------|-------------------------------|
| `<bitmap>` | The Bitmap value |
-| `<position>` | The starting position (inclusive) |
+| `<position>` | The starting position (inclusive),If the index is
negative, the last element is -1. |
| `<cardinality_limit>` | The maximum number of elements |
## Return Value
A subset Bitmap within the specified range and limit.
+- If the parameter is NULL, returns NULL
+
## Examples
@@ -76,3 +78,17 @@ The result will be:
| 2,3,5 |
+-------+
```
+
+```sql
+select bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), 2,
NULL)) value;
+```
+
+The result will be:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
index e7900423762..4043ebbccf9 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
@@ -21,43 +21,86 @@ TO_BITMAP(<expr>)
| Parameter | Description |
|-----------|----------------------------------------------------|
-| `<expr>` | An unsigned bigint with a range of 0 to 18446744073709551615 |
+| `<expr>` | An unsigned bigint or numbers represented as strings with a
range of 0 to 18446744073709551615 |
## Return Value
A Bitmap containing the corresponding bigint.
-Returns `NULL` if the input value is not within the specified range.
+Returns empty bitmap if the input value is not within the specified range.
## Examples
To convert an integer to a Bitmap and count the number of elements in the
Bitmap:
```sql
-select bitmap_count(to_bitmap(10));
+select bitmap_to_string(to_bitmap(10)),bitmap_count(to_bitmap(10));
```
The result will be:
```text
-+-----------------------------+
-| bitmap_count(to_bitmap(10)) |
-+-----------------------------+
-| 1 |
-+-----------------------------+
++---------------------------------+-----------------------------+
+| bitmap_to_string(to_bitmap(10)) | bitmap_count(to_bitmap(10)) |
++---------------------------------+-----------------------------+
+| 10 | 1 |
++---------------------------------+-----------------------------+
+```
+
+```sql
+select bitmap_to_string(to_bitmap("123")),bitmap_count(to_bitmap("123"));
+```
+
+The result will be:
+
+```text
++------------------------------------+--------------------------------+
+| bitmap_to_string(to_bitmap("123")) | bitmap_count(to_bitmap("123")) |
++------------------------------------+--------------------------------+
+| 123 | 1 |
++------------------------------------+--------------------------------+
```
To convert a negative integer to a Bitmap, which is outside the valid range,
and convert it to a string:
```sql
-select bitmap_to_string(to_bitmap(-1));
+select bitmap_to_string(to_bitmap(-1)),bitmap_count(to_bitmap(-1));
+```
+
+The result will be:
+
+```text
++---------------------------------+-----------------------------+
+| bitmap_to_string(to_bitmap(-1)) | bitmap_count(to_bitmap(-1)) |
++---------------------------------+-----------------------------+
+| | 0 |
++---------------------------------+-----------------------------+
+```
+
+```sql
+select bitmap_to_string(to_bitmap("123ABC")),bitmap_count(to_bitmap("123ABC"));
```
The result will be:
```text
-+---------------------------------+
-| bitmap_to_string(to_bitmap(-1)) |
-+---------------------------------+
-| |
-+---------------------------------+
++---------------------------------------+-----------------------------------+
+| bitmap_to_string(to_bitmap("123ABC")) | bitmap_count(to_bitmap("123ABC")) |
++---------------------------------------+-----------------------------------+
+| | 0 |
++---------------------------------------+-----------------------------------+
+```
+
+
+```sql
+select bitmap_to_string(to_bitmap(NULL)),bitmap_count(to_bitmap(NULL));
```
+
+The result will be:
+
+```text
++-----------------------------------+-------------------------------+
+| bitmap_to_string(to_bitmap(NULL)) | bitmap_count(to_bitmap(NULL)) |
++-----------------------------------+-------------------------------+
+| | 0 |
++-----------------------------------+-------------------------------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
index 3cfd38e4030..df7d4e11e65 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-count.md
@@ -24,55 +24,55 @@ BITMAP_AND_COUNT(<bitmap>, <bitmap>,[, <bitmap>...])
## 返回值
返回整数
-- 当参数存在空值时,返回 NULL
+- 当参数存在NULL时,返回 0
## 举例
```sql
-select
bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5'));
+select
bitmap_and_count(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')) as
res;
```
```text
-+----------------------------------------------------------------------------+
-| bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+----------------------------------------------------------------------------+
-| 1 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
```
```sql
-select bitmap_and_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'));
+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;
```
```text
-+-------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) |
-+-------------------------------------------------------------------------------------------------------------+
-|
2 |
-+-------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 2 |
++------+
```
```sql
-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());
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'), bitmap_empty())) |
-+-----------------------------------------------------------------------------------------------------------------------------+
-|
0 |
-+-----------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
```sql
-select bitmap_and_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'), NULL);
+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;
```
```text
-+-------------------------------------------------------------------------------------------------------------------+
-| (bitmap_and_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'), NULL)) |
-+-------------------------------------------------------------------------------------------------------------------+
-|
NULL |
-+-------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
index 3b3b5c17731..f22496656c2 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not-count.md
@@ -29,12 +29,12 @@ BITMAP_AND_NOT_COUNT(<bitmap1>, <bitmap2>)
## 返回值
返回整数。
-- 当参数存在空值时,返回 NULL
+- 当参数存在NULL值时,返回 0
## 举例
```sql
-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;
+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;
```
```text
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
index 47e1d2f4d43..0d701a93753 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and-not.md
@@ -29,7 +29,7 @@ BITMAP_AND_NOT(<bitmap1>, <bitmap2>)
## 返回值
返回一个 BITMAP。
-- 当参数存在空值时,返回 NULL
+- 当参数存在NULL值时,返回 NULL
## 举例
@@ -46,37 +46,37 @@ select
bitmap_count(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_strin
```
```sql
-select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')));
+select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_from_string('3,4,5')))
as cnt;
```
```text
-+--------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'))) |
-+--------------------------------------------------------------------------------------------+
-| 1,2
|
-+--------------------------------------------------------------------------------------------+
++------+
+| cnt |
++------+
+| 1,2 |
++------+
```
```sql
-select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()));
+select
bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),bitmap_empty()))
cnt;
```
```text
-+-------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),
bitmap_empty())) |
-+-------------------------------------------------------------------------------+
-| 1,2,3
|
-+-------------------------------------------------------------------------------+
++-------+
+| cnt |
++-------+
+| 1,2,3 |
++-------+
```
```sql
-select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL));
+select bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'),NULL)) as
res;
```
```text
-+---------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and_not(bitmap_from_string('1,2,3'), NULL)) |
-+---------------------------------------------------------------------+
-| NULL |
-+---------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
index cd90f02c762..2095ebcc105 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-and.md
@@ -24,44 +24,44 @@ BITMAP_AND(<bitmap>, <bitmap>,[, <bitmap>...])
## 返回值
返回一个 BITMAP
-- 当参数存在空值时,返回 NULL
+- 当参数存在NULL时,返回 NULL
## 举例
```sql
-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')));
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_and(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2'), bitmap_from_string('1,2,3,4,5'))) |
-+-----------------------------------------------------------------------------------------------------------------------+
-| 1,2
|
-+-----------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1,2 |
++------+
```
```sql
-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()));
+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;
```
```text
-+---------------------------------------------------------------------------------------------------------------------------------------+
-| 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())) |
-+---------------------------------------------------------------------------------------------------------------------------------------+
-|
|
-+---------------------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| |
++------+
```
```sql
-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));
+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;
```
```text
-+-----------------------------------------------------------------------------------------------------------------------------+
-| 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)) |
-+-----------------------------------------------------------------------------------------------------------------------------+
-| NULL
|
-+-----------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
index 7e9dc92a264..253c8c6958e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-contains.md
@@ -25,7 +25,7 @@ BITMAP_CONTAINS(<bitmap>, <bigint>)
## 返回值
返回一个 boolean
-- 当参数存在空时,返回 NULL
+- 当参数存在NULL值时,返回 NULL
## 举例
@@ -41,3 +41,15 @@ select bitmap_contains(to_bitmap(1),2) cnt1,
bitmap_contains(to_bitmap(1),1) cnt
+------+------+
```
+```sql
+select bitmap_contains(NULL,2) cnt1, bitmap_contains(to_bitmap(1),NULL) cnt2;
+```
+
+```text
++------+------+
+| cnt1 | cnt2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
+
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
index 573315c0692..4d6bde6101f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-count.md
@@ -38,3 +38,15 @@ select bitmap_count(to_bitmap(1)) cnt;
| 1 |
+------+
```
+
+```sql
+select bitmap_count(bitmap_empty()) cnt;
+```
+
+```text
++------+
+| cnt |
++------+
+| 0 |
++------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
index 63dcc27612d..3d7b11954f2 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-array.md
@@ -40,3 +40,26 @@ SELECT bitmap_to_string(bitmap_from_array(array(1, 0, 1, 1,
0, 1, 0))) AS bs;
+------+
```
+```sql
+SELECT bitmap_to_string(bitmap_from_array(NULL)) AS bs;
+```
+
+```text
++------+
+| bs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_array([1,2,3,-1]));
+```
+
+```text
++-------------------------------------------------+
+| bitmap_to_string(bitmap_from_array([1,2,3,-1])) |
++-------------------------------------------------+
+| NULL |
++-------------------------------------------------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
index 57819e6c7d6..64a1c77a0f4 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-base64.md
@@ -28,6 +28,18 @@
## 举例
+```sql
+select bitmap_to_string(bitmap_from_base64("invalid")) bts;
+```
+
+```text
++------+
+| bts |
++------+
+| NULL |
++------+
+```
+
```sql
select bitmap_to_string(bitmap_from_base64("AA==")) bts;
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
index 26180b9a3af..af291d0e8aa 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-from-string.md
@@ -42,7 +42,31 @@ select bitmap_to_string(bitmap_from_string("0, 1, 2")) bts;
```
```sql
-select bitmap_from_string("-1, 0, 1, 2") bfs;
+select bitmap_to_string(bitmap_from_string("-1, 0, 1, 2")) bfs;
+```
+
+```text
++------+
+| bfs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_string(NULL)) bfs;
+```
+
+```text
++------+
+| bfs |
++------+
+| NULL |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_from_string("18446744073709551616, 1")) bfs;
```
```text
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
index 8e0e6bcd602..463360e7f8f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-all.md
@@ -28,37 +28,52 @@ bitmap_has_all(<bitmap1>, <bitmap2>)
如果 `<bitmap1>` 包含 `<bitmap2>` 的全部元素,则返回 true;
如果 `<bitmap2>` 包含的元素为空,返回 true;
否则返回 false。
+- 当参数存在NULL时,返回 NULL
## 示例
检查一个 Bitmap 是否包含另一个 Bitmap 的全部元素:
```sql
-select bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1,
2'));
+select bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1,
2')) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------+
-| bitmap_has_all(bitmap_from_string('0, 1, 2'), bitmap_from_string('1, 2')) |
-+---------------------------------------------------------------------------+
-| 1 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
```
检查一个空 Bitmap 是否包含另一个 Bitmap 的全部元素:
```sql
-select bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2'));
+select bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2')) as res;
```
结果如下:
```text
-+------------------------------------------------------------+
-| bitmap_has_all(bitmap_empty(), bitmap_from_string('1, 2')) |
-+------------------------------------------------------------+
-| 0 |
-+------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
+```
+
+```sql
+select bitmap_has_all(bitmap_empty(), NULL) as res;
+```
+
+结果如下:
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
index 27f0b1e56aa..9e7b4289ffd 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-has-any.md
@@ -26,37 +26,52 @@ bitmap_has_any(<bitmap1>, <bitmap2>)
如果两个 Bitmap 存在相同元素,返回 true;
如果两个 Bitmap 不存在相同元素,返回 false。
+- 当参数存在NULL时,返回 NULL
## 示例
检查一个 Bitmap 是否包含另一个 Bitmap 的任意元素:
```sql
-mysql> select bitmap_has_any(to_bitmap(1), to_bitmap(2));
+select bitmap_has_any(to_bitmap(1), to_bitmap(2)) as res;
```
结果如下:
```text
-+--------------------------------------------+
-| bitmap_has_any(to_bitmap(1), to_bitmap(2)) |
-+--------------------------------------------+
-| 0 |
-+--------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
检查一个 Bitmap 是否包含自身的任意元素:
```sql
-mysql> select bitmap_has_any(to_bitmap(1), to_bitmap(1));
+select bitmap_has_any(bitmap_from_string('1,2,3'), to_bitmap(1)) as res;
```
结果如下:
```text
-+--------------------------------------------+
-| bitmap_has_any(to_bitmap(1), to_bitmap(1)) |
-+--------------------------------------------+
-| 1 |
-+--------------------------------------------+
++------+
+| res |
++------+
+| 1 |
++------+
+```
+
+```sql
+select bitmap_has_any(bitmap_from_string('1,2,3'), NULL) as res;
+```
+
+结果如下:
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
index 9954d70299d..6399fe54077 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash.md
@@ -24,6 +24,7 @@ bitmap_hash(<expr>)
## 返回值
包含参数 `<expr>` 的 64 位 hash 值的 Bitmap。
+- 当参数存在NULL时,返回 Empty Bitmap
::: note
@@ -66,3 +67,18 @@ select bitmap_count(bitmap_union(bitmap_hash(`word`))) from
`words`;
| 33263478 |
+-------------------------------------------------+
```
+
+
+```sql
+select bitmap_to_string(bitmap_hash(NULL));
+```
+
+结果如下:
+
+```text
++------+
+| res |
++------+
+| |
++------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
index 43f3d3afe29..3e9015bcdff 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-hash64.md
@@ -24,6 +24,7 @@ bitmap_hash64(<expr>)
## 返回值
包含参数 `<expr>` 的 64 位 hash 值的 Bitmap。
+- 当参数存在NULL时,返回 Empty Bitmap
## 示例
@@ -42,3 +43,17 @@ select bitmap_to_string(bitmap_hash64('hello'));
| 15231136565543391023 |
+------------------------------------------+
```
+
+```sql
+select bitmap_to_string(bitmap_hash64(NULL));
+```
+
+结果如下:
+
+```text
++---------------------------------------+
+| bitmap_to_string(bitmap_hash64(NULL)) |
++---------------------------------------+
+| |
++---------------------------------------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
index e5c8cb3a47d..8f8d08b91c3 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-max.md
@@ -24,7 +24,7 @@ bitmap_max(<bitmap>)
## 返回值
Bitmap 中的最大值。
-若 Bitmap 为空则返回 `NULL`。
+若 Bitmap 为空或者为NULL则返回 `NULL`。
## 示例
@@ -59,3 +59,17 @@ select bitmap_max(bitmap_from_string('1,9999999999')) value;
| 9999999999 |
+------------+
```
+
+```sql
+select bitmap_max(bitmap_empty()) res1,bitmap_max(NULL) res2;
+```
+
+结果如下:
+
+```text
++------+------+
+| res1 | res2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
index df3ba14c250..14918042214 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-min.md
@@ -24,7 +24,7 @@ bitmap_min(<bitmap>)
## 返回值
Bitmap 中的最小值。
-若 Bitmap 为空则返回 `NULL`。
+若 Bitmap 为空或者为NULL则返回 `NULL`。
## 示例
@@ -59,3 +59,17 @@ select bitmap_min(bitmap_from_string('1,9999999999')) value;
| 1 |
+-------+
```
+
+```sql
+select bitmap_min(bitmap_empty()) res1,bitmap_min(NULL) res2;
+```
+
+结果如下:
+
+```text
++------+------+
+| res1 | res2 |
++------+------+
+| NULL | NULL |
++------+------+
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
index 8fc183d90ff..972a304f185 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-not.md
@@ -25,39 +25,50 @@ bitmap_not(<bitmap1>, <bitmap2>)
## 返回值
`<bitmap1>` 减去 `<bitmap2>` 后集合的 Bitmap。
+- 当参数存在NULL时,返回 NULL
## 示例
计算两个 Bitmap 之间的差集:
```sql
-select bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) as res;
```
结果如下,因 `<bitmap1>` 的所有元素也在 `<bitmap2>` 中,所以结果是一个空的 Bitmap:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_not(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-|
|
-+----------------------------------------------------------------------------------------+
-1 row in set (0.01 sec)
++------+
+| res |
++------+
+| |
++------+
```
计算 `<bitmap1>` 中存在但 `<bitmap2>` 中不存在的元素的差集:
```sql
-select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4'))) as res;
```
结果如下,将是一个包含元素 `5` 的 Bitmap:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-| 5
|
-+----------------------------------------------------------------------------------------+
-1 row in set (0.01 sec)
++------+
+| res |
++------+
+| 5 |
++------+
+```
+
+```sql
+select bitmap_to_string(bitmap_not(bitmap_from_string('2,3,5'), NULL)) as res;
+```
+
+```text
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
index cff20963e68..1238a24d793 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or-count.md
@@ -27,86 +27,85 @@ bitmap_or_count(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## 返回值
多个 Bitmap 并集的元素个数。
-如果有 Bitmap 为 `NULL` 则返回 `NULL`。
## 示例
计算一个非空 Bitmap 和一个空 Bitmap 的并集中的元素数量:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty());
+select bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty()) res;
```
结果如下:
```text
-+--------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_empty()) |
-+--------------------------------------------------------------+
-| 3 |
-+--------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
计算两个相同 Bitmap 的并集中的元素数量:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3'));
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3')) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
-+---------------------------------------------------------------------------+
-| 3 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
计算两个不同 Bitmap 的并集中的元素数量:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'));
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5')) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+---------------------------------------------------------------------------+
-| 5 |
-+---------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 5 |
++------+
```
计算多个 Bitmap(包括一个空 Bitmap)的并集中的元素数量:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty());
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), bitmap_empty()) res;
```
结果如下:
```text
-+-----------------------------------------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'),
to_bitmap(100), bitmap_empty()) |
-+-----------------------------------------------------------------------------------------------------------+
-|
6 |
-+-----------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
计算多个 Bitmap(包括一个 `NULL` 值)的并集中的元素数量:
```sql
-select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), NULL);
+select bitmap_or_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'), to_bitmap(100), NULL) res;
```
结果如下:
```text
-+-------------------------------------------------------------------------------------------------+
-| bitmap_or_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5'),
to_bitmap(100), NULL) |
-+-------------------------------------------------------------------------------------------------+
-|
NULL |
-+-------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
index cd058571cf5..c85a564569e 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-or.md
@@ -97,47 +97,47 @@ select bitmap_to_string(bitmap_or(to_bitmap(1),
to_bitmap(2)));
计算多个 Bitmap(包括 `NULL` 值)的并集:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL)) as res;
```
结果如下:
```text
-+--------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), NULL)) |
-+--------------------------------------------------------------------------------------------+
-| 0,1,2,10
|
-+--------------------------------------------------------------------------------------------+
++----------+
+| res |
++----------+
+| 0,1,2,10 |
++----------+
```
计算多个 Bitmap(包括空 Bitmap)的并集:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty()));
+select bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty())) as res;
```
结果如下:
```text
-+------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(1), to_bitmap(2), to_bitmap(10),
to_bitmap(0), bitmap_empty())) |
-+------------------------------------------------------------------------------------------------------+
-| 0,1,2,10
|
-+------------------------------------------------------------------------------------------------------+
++----------+
+| res |
++----------+
+| 0,1,2,10 |
++----------+
```
计算由字符串和单个值创建的 Bitmap 的并集:
```sql
-select bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5')));
+select bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) as res;
```
结果如下:
```text
-+--------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_or(to_bitmap(10), bitmap_from_string('1,2'),
bitmap_from_string('1,2,3,4,5'))) |
-+--------------------------------------------------------------------------------------------------------+
-| 1,2,3,4,5,10
|
-+--------------------------------------------------------------------------------------------------------+
++--------------+
+| res |
++--------------+
+| 1,2,3,4,5,10 |
++--------------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
index 7c002dde40f..cdb36a33327 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-in-range.md
@@ -26,6 +26,8 @@ bitmap_subset_in_range(<bitmap>, <range_start_include>,
<range_end_exclude>)
## 返回值
指定范围的子集 Bitmap。
+- 当参数存在NULL时或者指定范围为非法范围时,返回 NULL
+
## 示例
@@ -60,3 +62,33 @@ select
bitmap_to_string(bitmap_subset_in_range(bitmap_from_string('1,2,3,4,5'),
| 2 |
+-------+
```
+
+
+```sql
+select
bitmap_to_string(bitmap_subset_in_range(bitmap_from_string('1,2,3,4,5'), 2,
NULL)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+
+```sql
+select
bitmap_to_string(bitmap_subset_in_range(bitmap_from_string('1,2,3,4,5'), 2,
-10000)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
index e2397b7b1cd..ffe6b1ad81c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-subset-limit.md
@@ -26,6 +26,7 @@ bitmap_subset_limit(<bitmap>, <position>, <cardinality_limit>)
## 返回值
指定范围的子集 Bitmap。
+- 当参数存在NULL时或者指定范围为非法取值时,返回 NULL
## 示例
@@ -60,3 +61,45 @@ select
bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'), 4,
| 4,5 |
+-------+
```
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
4, NULL)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
-4, 3)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
+
+```sql
+select bitmap_to_string(bitmap_subset_limit(bitmap_from_string('1,2,3,4,5'),
4, -3)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
index ebec0a189ef..428fae94233 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor-count.md
@@ -27,103 +27,103 @@ bitmap_xor_count(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## 返回值
将两个及以上 Bitmap 集合进行异或操作得到的差集 Bitmap 元素数量。
-当输入的 Bitmap 参数中有 `NULL` 时,结果为 `NULL`。
+当输入的 Bitmap 参数中有 `NULL` 时,结果为 0。
## 示例
计算两个 Bitmap 的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('3,4,5')) res;
```
结果如下:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('3,4,5')) |
-+----------------------------------------------------------------------------+
-| 4 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 4 |
++------+
```
计算两个相同 Bitmap 的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('1,2,3')) res;
```
结果如下:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('1,2,3')) |
-+----------------------------------------------------------------------------+
-| 0 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
计算两个不同 Bitmap 的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('4,5,6'));
+select bitmap_xor_count(bitmap_from_string('1,2,3'),
bitmap_from_string('4,5,6')) as res;
```
结果如下:
```text
-+----------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('1,2,3'), bitmap_from_string('4,5,6')) |
-+----------------------------------------------------------------------------+
-| 6 |
-+----------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 6 |
++------+
```
计算三个 Bitmap 的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'));
+select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5')) res;
```
结果如下:
```text
-+-----------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5')) |
-+-----------------------------------------------------------------------------------------------------------+
-|
3 |
-+-----------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
计算多个 Bitmap(包括一个空 Bitmap)的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty());
+select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty()) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5'), bitmap_empty()) |
-+---------------------------------------------------------------------------------------------------------------------------+
-|
3 |
-+---------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 3 |
++------+
```
计算多个 Bitmap(包括一个 `NULL` 值)的对称差集中的元素数量:
```sql
-select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL);
+select bitmap_xor_count(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL) res;
```
结果如下:
```text
-+-----------------------------------------------------------------------------------------------------------------+
-| bitmap_xor_count(bitmap_from_string('2,3'), bitmap_from_string('1,2,3,4'),
bitmap_from_string('3,4,5'), NULL) |
-+-----------------------------------------------------------------------------------------------------------------+
-|
NULL |
-+-----------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 0 |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
index 67976269095..be4b71ba355 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/bitmap-xor.md
@@ -27,6 +27,7 @@ bitmap_xor(<bitmap1>, <bitmap2>, ..., <bitmapN>)
## 返回值
多个 Bitmap 差集的 Bitmap。
+- 当参数存在NULL时,返回 NULL
## 示例
@@ -49,63 +50,63 @@ select bitmap_count(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,
将两个 Bitmap 的对称差集转换为字符串:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4')));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) res;
```
结果如下:
```text
-+----------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'))) |
-+----------------------------------------------------------------------------------------+
-| 1,4
|
-+----------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| 1,4 |
++------+
```
计算三个 Bitmap 的对称差集:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5')));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'))) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'))) |
-+---------------------------------------------------------------------------------------------------------------------+
-| 1,3,5
|
-+---------------------------------------------------------------------------------------------------------------------+
++-------+
+| res |
++-------+
+| 1,3,5 |
++-------+
```
计算多个 Bitmap(包括一个空 Bitmap)的对称差集:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty()));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty()))
res;
```
结果如下:
```text
-+-------------------------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), bitmap_empty())) |
-+-------------------------------------------------------------------------------------------------------------------------------------+
-| 1,3,5
|
-+-------------------------------------------------------------------------------------------------------------------------------------+
++-------+
+| res |
++-------+
+| 1,3,5 |
++-------+
```
计算多个 Bitmap(包括一个 `NULL` 值)的对称差集:
```sql
-select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL));
+select bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL)) res;
```
结果如下:
```text
-+---------------------------------------------------------------------------------------------------------------------------+
-| bitmap_to_string(bitmap_xor(bitmap_from_string('2,3'),
bitmap_from_string('1,2,3,4'), bitmap_from_string('3,4,5'), NULL)) |
-+---------------------------------------------------------------------------------------------------------------------------+
-| NULL
|
-+---------------------------------------------------------------------------------------------------------------------------+
++------+
+| res |
++------+
+| NULL |
++------+
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
index 17ebb1c75b1..76370925c41 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/sub-bitmap.md
@@ -15,18 +15,19 @@
sub_bitmap(<bitmap>, <position>, <cardinality_limit>)
```
-## 返回值
-
-指定范围的子集 Bitmap。
-
## 参数
| 参数 | 描述 |
|-----------|-------------|
| `<bitmap>` | Bitmap 值 |
-| `<position>` | 范围开始的位置(包含) |
+| `<position>` | 范围开始的位置(包含),若为负数时,则最后一个元素为-1 |
| `<cardinality_limit>` | 基数上限 |
+## 返回值
+
+指定范围的子集 Bitmap。
+- 当参数存在NULL值时,返回 NULL
+
## 示例
获取从位置 0 开始,基数限制为 3 的 Bitmap 子集:
@@ -76,3 +77,17 @@ select
bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), 2, 100))
| 2,3,5 |
+-------+
```
+
+```sql
+select bitmap_to_string(sub_bitmap(bitmap_from_string('1,0,1,2,3,1,5'), 2,
NULL)) value;
+```
+
+结果如下:
+
+```text
++-------+
+| value |
++-------+
+| NULL |
++-------+
+```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
index 229b3df4519..c6557b2426b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/bitmap-functions/to-bitmap.md
@@ -19,43 +19,88 @@
| 参数 | 描述 |
|-----------|----------------------------------------|
-| `<expr>` | 无符号的长整型数,范围为 0 ~ 18446744073709551615 |
+| `<expr>` | 无符号的长整型数或者字符串表示的数字,范围为 0 ~ 18446744073709551615 |
## 返回值
包含对应长整型数的 Bitmap。
-当输入值不在对应范围内时,则返回 `NULL`。
+当输入整型值不在对应范围内时或者字符串无法解析成数字时,则返回一个empty bitmap。
## 示例
将一个整数转换为 Bitmap 并计算 Bitmap 中的元素数量:
```sql
-select bitmap_count(to_bitmap(10));
+select bitmap_to_string(to_bitmap(10)),bitmap_count(to_bitmap(10));
```
结果如下:
```text
-+-----------------------------+
-| bitmap_count(to_bitmap(10)) |
-+-----------------------------+
-| 1 |
-+-----------------------------+
++---------------------------------+-----------------------------+
+| bitmap_to_string(to_bitmap(10)) | bitmap_count(to_bitmap(10)) |
++---------------------------------+-----------------------------+
+| 10 | 1 |
++---------------------------------+-----------------------------+
+```
+
+```sql
+select bitmap_to_string(to_bitmap("123")),bitmap_count(to_bitmap("123"));
+```
+
+结果如下:
+
+```text
++------------------------------------+--------------------------------+
+| bitmap_to_string(to_bitmap("123")) | bitmap_count(to_bitmap("123")) |
++------------------------------------+--------------------------------+
+| 123 | 1 |
++------------------------------------+--------------------------------+
```
将一个负整数转换为 Bitmap(该整数在有效范围之外),并将其转换为字符串:
```sql
-select bitmap_to_string(to_bitmap(-1));
+select bitmap_to_string(to_bitmap(-1)),bitmap_count(to_bitmap(-1));
```
结果如下:
```text
-+---------------------------------+
-| bitmap_to_string(to_bitmap(-1)) |
-+---------------------------------+
-| |
-+---------------------------------+
++---------------------------------+-----------------------------+
+| bitmap_to_string(to_bitmap(-1)) | bitmap_count(to_bitmap(-1)) |
++---------------------------------+-----------------------------+
+| | 0 |
++---------------------------------+-----------------------------+
+```
+
+非法的数字字符串:
+
+```sql
+select bitmap_to_string(to_bitmap("123ABC")),bitmap_count(to_bitmap("123ABC"));
+```
+
+结果如下:
+
+```text
++---------------------------------------+-----------------------------------+
+| bitmap_to_string(to_bitmap("123ABC")) | bitmap_count(to_bitmap("123ABC")) |
++---------------------------------------+-----------------------------------+
+| | 0 |
++---------------------------------------+-----------------------------------+
+```
+
+
+```sql
+select bitmap_to_string(to_bitmap(NULL)),bitmap_count(to_bitmap(NULL));
+```
+
+The result will be:
+
+```text
++-----------------------------------+-------------------------------+
+| bitmap_to_string(to_bitmap(NULL)) | bitmap_count(to_bitmap(NULL)) |
++-----------------------------------+-------------------------------+
+| | 0 |
++-----------------------------------+-------------------------------+
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]