This is an automated email from the ASF dual-hosted git repository.

zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ccaa97a  Make bitmap functions accept any expression that returns 
bitmap (#2728)
ccaa97a is described below

commit ccaa97a5acc369f08b96f29dd9d85e3be6620032
Author: Dayue Gao <[email protected]>
AuthorDate: Sat Jan 11 14:02:12 2020 +0800

    Make bitmap functions accept any expression that returns bitmap (#2728)
    
    This CL make bitmap_count, bitmap_union, and bitmap_union_count accept any 
expression whose return type is bitmap as input so that we can support flexible 
bitmap expression such as bitmap_count(bitmap_and(to_bitmap(1), to_bitmap(2))).
    
    This CL also create separate documentation for each bitmap UDF to conform 
with other functions.
---
 .../sql-functions/aggregate-functions/bitmap.md    | 19 +-----
 .../sql-functions/bitmap-functions/bitmap_and.md   | 48 +++++++++++++++
 .../sql-functions/bitmap-functions/bitmap_empty.md | 45 ++++++++++++++
 .../sql-functions/bitmap-functions/bitmap_hash.md  | 45 ++++++++++++++
 .../sql-functions/bitmap-functions/bitmap_or.md    | 48 +++++++++++++++
 .../sql-functions/bitmap-functions/index.rst       |  8 +++
 .../sql-functions/bitmap-functions/to_bitmap.md    | 46 +++++++++++++++
 .../sql-statements/Data Definition/CREATE TABLE.md |  3 +-
 .../sql-functions/aggregate-functions/bitmap_EN.md | 23 ++------
 .../bitmap-functions/bitmap_and_EN.md              | 48 +++++++++++++++
 .../bitmap-functions/bitmap_empty_EN.md            | 45 ++++++++++++++
 .../bitmap-functions/bitmap_hash_EN.md             | 45 ++++++++++++++
 .../sql-functions/bitmap-functions/bitmap_or_EN.md | 48 +++++++++++++++
 .../sql-functions/bitmap-functions/index.rst       |  8 +++
 .../sql-functions/bitmap-functions/to_bitmap_EN.md | 45 ++++++++++++++
 .../Data Definition/CREATE TABLE_EN.md             |  1 -
 .../apache/doris/analysis/FunctionCallExpr.java    | 69 +++-------------------
 gensrc/script/doris_builtins_functions.py          |  2 +-
 18 files changed, 495 insertions(+), 101 deletions(-)

diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/bitmap.md
 
b/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/bitmap.md
index 9416e74..d2c8593 100644
--- 
a/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/bitmap.md
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/aggregate-functions/bitmap.md
@@ -22,6 +22,7 @@ under the License.
 ## Create table
 
 建表时需要使用聚合模型,数据类型是 bitmap , 聚合函数是 bitmap_union
+
 ```
 CREATE TABLE `pv_bitmap` (
   `dt` int(11) NULL COMMENT "",
@@ -92,11 +93,9 @@ insert into bitmap_table1 select id, bitmap_hash(id_string) 
from table;
 ### Syntax
 
 
-`BITMAP_UNION(expr)` : 计算两个 Bitmap 的并集,返回值是序列化后的 Bitmap 值
-
-`BITMAP_COUNT(expr)` : 计算 Bitmap 中不同值的个数
+`BITMAP_UNION(expr)` : 计算输入 Bitmap 的并集,返回新的bitmap
 
-`BITMAP_UNION_COUNT(expr)`: 计算两个 Bitmap 的并集的基数值,和 
BITMAP_COUNT(BITMAP_UNION(expr)) 等价
+`BITMAP_UNION_COUNT(expr)`: 计算输入 Bitmap 的并集,返回其基数,和 
BITMAP_COUNT(BITMAP_UNION(expr)) 等价。目前推荐优先使用 BITMAP_UNION_COUNT ,其性能优于 
BITMAP_COUNT(BITMAP_UNION(expr))
 
 `BITMAP_UNION_INT(expr)` : 计算 TINYINT,SMALLINT 和 INT 类型的列中不同值的个数,返回值和
 COUNT(DISTINCT expr) 相同
@@ -105,18 +104,6 @@ COUNT(DISTINCT expr) 相同
 filter_column 过滤条件的多个 bitmap 的交集的基数值。
 bitmap_column_to_count 是 bitmap 类型的列,filter_column 是变化的维度列,filter_values 
是维度取值列表
 
-`BITMAP_OR(expr,expr)`: 计算两个Bitmap列的并集,返回值是序列化后 Bitmap 值
-
-`BITMAP_AND(expr,expr)`:计算两个Bitmap列的交集,返回值是序列化后 Bitmap 值
-
-
-
-注意:
-       1. BITMAP_UNION 函数的参数目前仅支持: 
-               - 聚合模型中聚合类型为 BITMAP_UNION 的列
-               - TO_BITMAP, BITMAP_HASH 和 BITMAP_EMPTY 函数
-       2. 推荐优先使用 BITMAP_UNION_COUNT 函数,其性能优于 BITMAP_COUNT(BITMAP_UNION(expr))
-
 
 ### Example
 
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_and.md
 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_and.md
new file mode 100644
index 0000000..bafe178
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_and.md
@@ -0,0 +1,48 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_and
+## description
+### Syntax
+
+`BITMAP BITMAP_AND(BITMAP lhs, BITMAP rhs)`
+
+计算两个输入bitmap的交集,返回新的bitmap.
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_and(to_bitmap(1), to_bitmap(2))) cnt;
++------+
+| cnt  |
++------+
+|    0 |
++------+
+
+mysql> select bitmap_count(bitmap_and(to_bitmap(1), to_bitmap(1))) cnt;
++------+
+| cnt  |
++------+
+|    1 |
++------+
+```
+
+## keyword
+
+    BITMAP_AND,BITMAP
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_empty.md
 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_empty.md
new file mode 100644
index 0000000..3d329a5
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_empty.md
@@ -0,0 +1,45 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_empty
+## description
+### Syntax
+
+`BITMAP BITMAP_EMPTY()`
+
+返回一个空bitmap。主要用于 insert 或 stream load 时填充默认值。例如
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,v1,v2=bitmap_empty()"   http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_empty());
++------------------------------+
+| bitmap_count(bitmap_empty()) |
++------------------------------+
+|                            0 |
++------------------------------+
+```
+
+## keyword
+
+    BITMAP_EMPTY,BITMAP
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_hash.md
 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_hash.md
new file mode 100644
index 0000000..87efc11
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_hash.md
@@ -0,0 +1,45 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_hash
+## description
+### Syntax
+
+`BITMAP BITMAP_HASH(expr)`
+
+对任意类型的输入计算32位的哈希值,返回包含该哈希值的bitmap。主要用于stream load任务将非整型字段导入Doris表的bitmap字段。例如
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,device_id, device_id=bitmap_hash(device_id)"   
http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_hash('hello'));
++------------------------------------+
+| bitmap_count(bitmap_hash('hello')) |
++------------------------------------+
+|                                  1 |
++------------------------------------+
+```
+
+## keyword
+
+    BITMAP_HASH,BITMAP
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_or.md
 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_or.md
new file mode 100644
index 0000000..1c0bca7
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/bitmap_or.md
@@ -0,0 +1,48 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_or
+## description
+### Syntax
+
+`BITMAP BITMAP_OR(BITMAP lhs, BITMAP rhs)`
+
+计算两个输入bitmap的并集,返回新的bitmap.
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_or(to_bitmap(1), to_bitmap(2))) cnt;
++------+
+| cnt  |
++------+
+|    2 |
++------+
+
+mysql> select bitmap_count(bitmap_or(to_bitmap(1), to_bitmap(1))) cnt;
++------+
+| cnt  |
++------+
+|    1 |
++------+
+```
+
+## keyword
+
+    BITMAP_OR,BITMAP
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/index.rst 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/index.rst
new file mode 100644
index 0000000..0a7ce16
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/index.rst
@@ -0,0 +1,8 @@
+=============
+bitmap函数
+=============
+
+.. toctree::
+    :glob:
+
+    *
diff --git 
a/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/to_bitmap.md
 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/to_bitmap.md
new file mode 100644
index 0000000..a82b8e3
--- /dev/null
+++ 
b/docs/documentation/cn/sql-reference/sql-functions/bitmap-functions/to_bitmap.md
@@ -0,0 +1,46 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# to_bitmap
+## description
+### Syntax
+
+`BITMAP TO_BITMAP(expr)`
+
+输入为取值在 0 ~ 4294967295 区间的 unsigned int ,输出为包含该元素的bitmap。
+该函数主要用于stream load任务将整型字段导入Doris表的bitmap字段。例如
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,user_id, user_id=to_bitmap(user_id)"   
http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(to_bitmap(10));
++-----------------------------+
+| bitmap_count(to_bitmap(10)) |
++-----------------------------+
+|                           1 |
++-----------------------------+
+```
+
+## keyword
+
+    TO_BITMAP,BITMAP
diff --git a/docs/documentation/cn/sql-reference/sql-statements/Data 
Definition/CREATE TABLE.md 
b/docs/documentation/cn/sql-reference/sql-statements/Data Definition/CREATE 
TABLE.md
index a8b88a1..736e35d 100644
--- a/docs/documentation/cn/sql-reference/sql-statements/Data Definition/CREATE 
TABLE.md        
+++ b/docs/documentation/cn/sql-reference/sql-statements/Data Definition/CREATE 
TABLE.md        
@@ -78,8 +78,7 @@ under the License.
             hll列类型,不需要指定长度和默认值、长度根据数据的聚合
             程度系统内控制,并且HLL列只能通过配套的hll_union_agg、Hll_cardinality、hll_hash进行查询或使用
         BITMAP
-            bitmap 列类型,不需要指定长度和默认值
-            BITMAP 列只能通过配套的 BITMAP_UNION、BITMAP_COUNT、TO_BITMAP 进行查询或使用
+            bitmap列类型,不需要指定长度和默认值
     ```
 
     agg_type:聚合类型,如果不指定,则该列为 key 列。否则,该列为 value 列
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/bitmap_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/bitmap_EN.md
index 829c54f..308ba54 100644
--- 
a/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/bitmap_EN.md
+++ 
b/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/bitmap_EN.md
@@ -95,30 +95,15 @@ insert into bitmap_table1 select id, bitmap_hash 
(id_string) from table;
 ### Syntax
 
 
-`BITMAP_UNION (expr)`: Calculate the union of two Bitmaps. The return value is 
the serialized Bitmap value.
+`BITMAP_UNION (expr)`: Calculate the union of two Bitmaps. The return value is 
the new Bitmap value.
 
-`BITMAP_COUNT (expr)`: Count the number of different values ​​in the Bitmap
+`BITMAP_UNION_COUNT (expr)`: Calculate the cardinality of the union of two 
Bitmaps, equivalent to BITMAP_COUNT (BITMAP_UNION (expr)). It is recommended to 
use the BITMAP_UNION_COUNT function first, its performance is better than 
BITMAP_COUNT (BITMAP_UNION (expr)).
 
-`BITMAP_UNION_COUNT (expr)`: Calculate the cardinality of the union of two 
Bitmaps, equivalent to BITMAP_COUNT (BITMAP_UNION (expr))
-
-`BITMAP_UNION_INT (expr)`: Count the number of different values ​​in columns 
of type TINYINT, SMALLINT and INT, return the sum of
-COUNT (DISTINCT expr) same
+`BITMAP_UNION_INT (expr)`: Count the number of different values ​​in columns 
of type TINYINT, SMALLINT and INT, return the sum of COUNT (DISTINCT expr) same
 
 `INTERSECT_COUNT (bitmap_column_to_count, filter_column, filter_values 
​​...)`: The calculation satisfies
 filter_column The cardinality of the intersection of multiple bitmaps of the 
filter.
-bitmap_column_to_count is a column of type bitmap, filter_column is a column 
of varying dimensions, and filter_values ​​is a list of dimension values
-
-`BITMAP_OR(expr,expr)`: Calculate the  or of two Bitmaps Column. The return 
value is the serialized Bitmap value.
-
-`BITMAP_AND(expr,expr)`:Calculate the and of two Bitmaps Column. The return 
value is the serialized Bitmap value.
-
-
-note:
-1. The parameters of the BITMAP_UNION function currently only support:
--Column with aggregation type BITMAP_UNION in the aggregation model
--TO_BITMAP, BITMAP_HASH and BITMAP_EMPTY functions
-2. It is recommended to use the BITMAP_UNION_COUNT function first, its 
performance is better than BITMAP_COUNT (BITMAP_UNION (expr))
-
+bitmap_column_to_count is a column of type bitmap, filter_column is a column 
of varying dimensions, and filter_values ​​is a list of dimension values.
 
 ### Example
 
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_and_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_and_EN.md
new file mode 100644
index 0000000..a7162e8
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_and_EN.md
@@ -0,0 +1,48 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_and
+## description
+### Syntax
+
+`BITMAP BITMAP_AND(BITMAP lhs, BITMAP rhs)`
+
+Compute intersection of two input bitmaps, return the new bitmap.
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_and(to_bitmap(1), to_bitmap(2))) cnt;
++------+
+| cnt  |
++------+
+|    0 |
++------+
+
+mysql> select bitmap_count(bitmap_and(to_bitmap(1), to_bitmap(1))) cnt;
++------+
+| cnt  |
++------+
+|    1 |
++------+
+```
+
+## keyword
+
+    BITMAP_AND,BITMAP
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_empty_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_empty_EN.md
new file mode 100644
index 0000000..acb8d58
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_empty_EN.md
@@ -0,0 +1,45 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_empty
+## description
+### Syntax
+
+`BITMAP BITMAP_EMPTY()`
+
+Return an empty bitmap. Mainly be used to supply default value for bitmap 
column when loading, e.g.,
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,v1,v2=bitmap_empty()"   http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_empty());
++------------------------------+
+| bitmap_count(bitmap_empty()) |
++------------------------------+
+|                            0 |
++------------------------------+
+```
+
+## keyword
+
+    BITMAP_EMPTY,BITMAP
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_hash_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_hash_EN.md
new file mode 100644
index 0000000..7c244ad
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_hash_EN.md
@@ -0,0 +1,45 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_hash
+## description
+### Syntax
+
+`BITMAP BITMAP_HASH(expr)`
+
+Compute the 32-bits hash value of a expr of any type, then return a bitmap 
containing that hash value. Mainly be used to load non-integer value into 
bitmap column, e.g.,
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,device_id, device_id=bitmap_hash(device_id)"   
http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_hash('hello'));
++------------------------------------+
+| bitmap_count(bitmap_hash('hello')) |
++------------------------------------+
+|                                  1 |
++------------------------------------+
+```
+
+## keyword
+
+    BITMAP_HASH,BITMAP
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_or_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_or_EN.md
new file mode 100644
index 0000000..5cfd58f
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/bitmap_or_EN.md
@@ -0,0 +1,48 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# bitmap_or
+## description
+### Syntax
+
+`BITMAP BITMAP_OR(BITMAP lhs, BITMAP rhs)`
+
+Compute union of two input bitmaps, returns the new bitmap.
+
+## example
+
+```
+mysql> select bitmap_count(bitmap_or(to_bitmap(1), to_bitmap(2))) cnt;
++------+
+| cnt  |
++------+
+|    2 |
++------+
+
+mysql> select bitmap_count(bitmap_or(to_bitmap(1), to_bitmap(1))) cnt;
++------+
+| cnt  |
++------+
+|    1 |
++------+
+```
+
+## keyword
+
+    BITMAP_OR,BITMAP
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/index.rst 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/index.rst
new file mode 100644
index 0000000..d0fe036
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/index.rst
@@ -0,0 +1,8 @@
+=============
+bitmap functions
+=============
+
+.. toctree::
+    :glob:
+
+    *
diff --git 
a/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/to_bitmap_EN.md
 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/to_bitmap_EN.md
new file mode 100644
index 0000000..16bca30
--- /dev/null
+++ 
b/docs/documentation/en/sql-reference/sql-functions/bitmap-functions/to_bitmap_EN.md
@@ -0,0 +1,45 @@
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# to_bitmap
+## description
+### Syntax
+
+`BITMAP TO_BITMAP(expr)`
+
+Convert an unsigned int (ranging from 0 to 4294967295) to a bitmap containing 
that value. Mainly be used to load interger value into bitmap column, e.g.,
+
+```
+cat data | curl --location-trusted -u user:passwd -T - -H "columns: 
dt,page,user_id, user_id=to_bitmap(user_id)"   
http://host:8410/api/test/testDb/_stream_load
+```
+
+## example
+
+```
+mysql> select bitmap_count(to_bitmap(10));
++-----------------------------+
+| bitmap_count(to_bitmap(10)) |
++-----------------------------+
+|                           1 |
++-----------------------------+
+```
+
+## keyword
+
+    TO_BITMAP,BITMAP
diff --git a/docs/documentation/en/sql-reference/sql-statements/Data 
Definition/CREATE TABLE_EN.md 
b/docs/documentation/en/sql-reference/sql-statements/Data Definition/CREATE 
TABLE_EN.md
index 6a6e14c..6dc2711 100644
--- a/docs/documentation/en/sql-reference/sql-statements/Data Definition/CREATE 
TABLE_EN.md     
+++ b/docs/documentation/en/sql-reference/sql-statements/Data Definition/CREATE 
TABLE_EN.md     
@@ -78,7 +78,6 @@ Syntax:
             This type can only be queried by hll_union_agg, hll_cardinality, 
hll_hash functions.
         BITMAP
             BITMAP type, No need to specify length.
-            This type can only be queried by 
BITMAP_UNION、BITMAP_COUNT、TO_BITMAP functions.
     ```
     agg_type: Aggregation type. If not specified, the column is key column. 
Otherwise, the column   is value column.
        * SUM、MAX、MIN、REPLACE
diff --git a/fe/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java 
b/fe/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 60bf18c..cba15ce 100644
--- a/fe/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -384,23 +384,6 @@ public class FunctionCallExpr extends Expr {
             throw new AnalysisException("BITMAP_UNION_INT params only support 
TINYINT or SMALLINT or INT");
         }
 
-        if 
((fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION_COUNT))) {
-            if (children.size() != 1) {
-                throw new AnalysisException("BITMAP_UNION_COUNT function could 
only have one child");
-            }
-
-            if (getChild(0) instanceof SlotRef) {
-                SlotRef slotRef = (SlotRef) getChild(0);
-                Column column = slotRef.getDesc().getColumn();
-                if (column != null && column.getAggregationType() != 
AggregateType.BITMAP_UNION) {
-                    throw new AnalysisException("BITMAP_UNION_COUNT function 
arg must be bitmap column");
-                }
-            } else {
-                throw new AnalysisException("BITMAP_UNION_COUNT function arg 
must be bitmap column");
-            }
-            return;
-        }
-
         if 
(fnName.getFunction().equalsIgnoreCase(FunctionSet.INTERSECT_COUNT)) {
             if (children.size() <= 2) {
                 throw new AnalysisException("intersect_count(bitmap_column, 
column_to_filter, filter_values) " +
@@ -425,53 +408,15 @@ public class FunctionCallExpr extends Expr {
             return;
         }
 
-        if ((fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_COUNT))) 
{
-            if (children.size() != 1) {
-                throw new AnalysisException("BITMAP_COUNT function could only 
have one child");
-            }
-
-            if (getChild(0) instanceof SlotRef) {
-                SlotRef slotRef = (SlotRef) getChild(0);
-                Column column = slotRef.getDesc().getColumn();
-                if (column != null && column.getAggregationType() != 
AggregateType.BITMAP_UNION) {
-                    throw new AnalysisException("BITMAP_COUNT function require 
the column is BITMAP_UNION aggregate type");
-                } else if (slotRef.getDesc().getSourceExprs().size() == 1) {
-                    Expr sourceExpr = 
slotRef.getDesc().getSourceExprs().get(0);
-                    if (sourceExpr instanceof FunctionCallExpr) {
-                        FunctionCallExpr functionExpr = (FunctionCallExpr) 
sourceExpr;
-                        if 
(!functionExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION))
 {
-                            throw new AnalysisException("BITMAP_COUNT function 
only support BITMAP_UNION function as it's child");
-                        }
-                    }
-                }
-            } else if (getChild(0) instanceof FunctionCallExpr) {
-                FunctionCallExpr functionCallExpr = (FunctionCallExpr) 
getChild(0);
-                if 
(!functionCallExpr.getFnName().getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION))
 {
-                    throw new AnalysisException("BITMAP_COUNT function only 
support BITMAP_UNION function as it's child");
-                }
-            } else {
-                throw new AnalysisException("BITMAP_COUNT only support 
BITMAP_UNION(column) or BITMAP_COUNT(BITMAP_UNION(column))");
-            }
-            return;
-        }
-
-        if ((fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION))) 
{
+        if (fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_COUNT)
+                || 
fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION)
+                || 
fnName.getFunction().equalsIgnoreCase(FunctionSet.BITMAP_UNION_COUNT)) {
             if (children.size() != 1) {
-                throw new AnalysisException("BITMAP_UNION function could only 
have one child");
+                throw new AnalysisException(fnName + " function could only 
have one child");
             }
-
-            if (getChild(0) instanceof SlotRef) {
-                SlotRef slotRef = (SlotRef) getChild(0);
-                if (slotRef.getDesc().getColumn().getAggregationType() != 
AggregateType.BITMAP_UNION) {
-                    throw new AnalysisException("BITMAP_UNION function require 
the column is BITMAP_UNION aggregate type");
-                }
-            } else if (getChild(0) instanceof FunctionCallExpr) {
-                FunctionCallExpr functionCallExpr = (FunctionCallExpr) 
getChild(0);
-                if (functionCallExpr.getFn().getReturnType() != Type.BITMAP) {
-                    throw new AnalysisException("BITMAP_UNION function require 
child function return type is BITMAP");
-                }
-            } else {
-                throw new AnalysisException("BITMAP_UNION only support 
BITMAP_UNION(column) or BITMAP_UNION(TO_BITMAP(column))");
+            Type inputType = getChild(0).getType();
+            if (!inputType.isBitmapType()) {
+                throw new AnalysisException(fnName + " function's argument 
should be of BITMAP type, but was " + inputType);
             }
             return;
         }
diff --git a/gensrc/script/doris_builtins_functions.py 
b/gensrc/script/doris_builtins_functions.py
index 0666315..6cdf709 100755
--- a/gensrc/script/doris_builtins_functions.py
+++ b/gensrc/script/doris_builtins_functions.py
@@ -606,7 +606,7 @@ visible_functions = [
         
'_ZN5doris15BitmapFunctions9to_bitmapEPN9doris_udf15FunctionContextERKNS1_9StringValE'],
     [['bitmap_hash'], 'BITMAP', ['VARCHAR'],
         
'_ZN5doris15BitmapFunctions11bitmap_hashEPN9doris_udf15FunctionContextERKNS1_9StringValE'],
-    [['bitmap_count'], 'BIGINT', ['VARCHAR'],
+    [['bitmap_count'], 'BIGINT', ['BITMAP'],
         
'_ZN5doris15BitmapFunctions12bitmap_countEPN9doris_udf15FunctionContextERKNS1_9StringValE'],
     [['bitmap_empty'], 'BITMAP', [],
         
'_ZN5doris15BitmapFunctions12bitmap_emptyEPN9doris_udf15FunctionContextE'],


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to