This is an automated email from the ASF dual-hosted git repository. liaoxin 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 83f1899e921 [docs](bitmap) add example of bitmap_from_string and bitmap_from_array (#2147) 83f1899e921 is described below commit 83f1899e921592b4586cec2915b65a888e7430fd Author: Kaijie Chen <c...@apache.org> AuthorDate: Thu Mar 6 16:11:10 2025 +0800 [docs](bitmap) add example of bitmap_from_string and bitmap_from_array (#2147) --- docs/data-operate/import/complex-types/bitmap.md | 62 +++++++++++++++++++++- .../data-operate/import/complex-types/bitmap.md | 61 ++++++++++++++++++++- .../data-operate/import/complex-types/bitmap.md | 61 ++++++++++++++++++++- .../data-operate/import/complex-types/bitmap.md | 61 ++++++++++++++++++++- .../data-operate/import/complex-types/bitmap.md | 62 +++++++++++++++++++++- .../data-operate/import/complex-types/bitmap.md | 62 +++++++++++++++++++++- 6 files changed, 363 insertions(+), 6 deletions(-) diff --git a/docs/data-operate/import/complex-types/bitmap.md b/docs/data-operate/import/complex-types/bitmap.md index 0e1fae97195..df16c88356c 100644 --- a/docs/data-operate/import/complex-types/bitmap.md +++ b/docs/data-operate/import/complex-types/bitmap.md @@ -85,4 +85,64 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 5 | jfin | 545679 | | 10 | buag | 97997 | +--------+-------+-----------------------+ -10 rows in set (0.07 sec) \ No newline at end of file +10 rows in set (0.07 sec) +``` + +## Importing a Bitmap Containing Multiple Elements + +The following demonstrates two methods for importing a bitmap column containing multiple elements using stream load. Users can choose the appropriate method based on their source file format. + +### bitmap_from_string + +When using `bitmap_from_string`, square brackets are not allowed in the arr column of the source file. Otherwise, it will be considered a data quality error. + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +When using `bitmap_from_array`, the source file can contain square brackets in the arr column. However, in stream load, the string type must first be cast to an array type before use. +If the cast conversion is not applied, an error will occur due to the function signature not being found: `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)` + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/complex-types/bitmap.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/complex-types/bitmap.md index 040898c7fb0..7b07fa32dc4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/complex-types/bitmap.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/data-operate/import/complex-types/bitmap.md @@ -86,4 +86,63 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 10 | buag | 97997 | +--------+-------+-----------------------+ 10 rows in set (0.07 sec) -``` \ No newline at end of file +``` + +## 导入含有多个元素的 bitmap + +以下展示了 stream load 导入含有多个元素的 bitmap 列的两种方法,用户可以根据自己源文件格式选择合适的方法。 + +### bitmap_from_string + +使用 `bitmap_from_string` 导入不允许源文件中 arr 列存在方括号,否则会认为是数据质量错误。 + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +使用 `bitmap_from_array` 导入允许源文件中 arr 列存在方括号,但是在 stream load 中必须先将 string 类型 cast 成 array 类型使用。 +如果不加 cast 转换参数类型,会因为找不到正确的函数签名报错 `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)`。 + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/complex-types/bitmap.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/complex-types/bitmap.md index 040898c7fb0..7b07fa32dc4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/complex-types/bitmap.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/data-operate/import/complex-types/bitmap.md @@ -86,4 +86,63 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 10 | buag | 97997 | +--------+-------+-----------------------+ 10 rows in set (0.07 sec) -``` \ No newline at end of file +``` + +## 导入含有多个元素的 bitmap + +以下展示了 stream load 导入含有多个元素的 bitmap 列的两种方法,用户可以根据自己源文件格式选择合适的方法。 + +### bitmap_from_string + +使用 `bitmap_from_string` 导入不允许源文件中 arr 列存在方括号,否则会认为是数据质量错误。 + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +使用 `bitmap_from_array` 导入允许源文件中 arr 列存在方括号,但是在 stream load 中必须先将 string 类型 cast 成 array 类型使用。 +如果不加 cast 转换参数类型,会因为找不到正确的函数签名报错 `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)`。 + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/complex-types/bitmap.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/complex-types/bitmap.md index 040898c7fb0..7b07fa32dc4 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/complex-types/bitmap.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/data-operate/import/complex-types/bitmap.md @@ -86,4 +86,63 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 10 | buag | 97997 | +--------+-------+-----------------------+ 10 rows in set (0.07 sec) -``` \ No newline at end of file +``` + +## 导入含有多个元素的 bitmap + +以下展示了 stream load 导入含有多个元素的 bitmap 列的两种方法,用户可以根据自己源文件格式选择合适的方法。 + +### bitmap_from_string + +使用 `bitmap_from_string` 导入不允许源文件中 arr 列存在方括号,否则会认为是数据质量错误。 + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +使用 `bitmap_from_array` 导入允许源文件中 arr 列存在方括号,但是在 stream load 中必须先将 string 类型 cast 成 array 类型使用。 +如果不加 cast 转换参数类型,会因为找不到正确的函数签名报错 `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)`。 + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +stream load 命令 + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` diff --git a/versioned_docs/version-2.1/data-operate/import/complex-types/bitmap.md b/versioned_docs/version-2.1/data-operate/import/complex-types/bitmap.md index 0e1fae97195..df16c88356c 100644 --- a/versioned_docs/version-2.1/data-operate/import/complex-types/bitmap.md +++ b/versioned_docs/version-2.1/data-operate/import/complex-types/bitmap.md @@ -85,4 +85,64 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 5 | jfin | 545679 | | 10 | buag | 97997 | +--------+-------+-----------------------+ -10 rows in set (0.07 sec) \ No newline at end of file +10 rows in set (0.07 sec) +``` + +## Importing a Bitmap Containing Multiple Elements + +The following demonstrates two methods for importing a bitmap column containing multiple elements using stream load. Users can choose the appropriate method based on their source file format. + +### bitmap_from_string + +When using `bitmap_from_string`, square brackets are not allowed in the arr column of the source file. Otherwise, it will be considered a data quality error. + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +When using `bitmap_from_array`, the source file can contain square brackets in the arr column. However, in stream load, the string type must first be cast to an array type before use. +If the cast conversion is not applied, an error will occur due to the function signature not being found: `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)` + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` diff --git a/versioned_docs/version-3.0/data-operate/import/complex-types/bitmap.md b/versioned_docs/version-3.0/data-operate/import/complex-types/bitmap.md index 0e1fae97195..df16c88356c 100644 --- a/versioned_docs/version-3.0/data-operate/import/complex-types/bitmap.md +++ b/versioned_docs/version-3.0/data-operate/import/complex-types/bitmap.md @@ -85,4 +85,64 @@ mysql> select typ_id,hou,bitmap_to_string(arr) from testdb.test_bitmap; | 5 | jfin | 545679 | | 10 | buag | 97997 | +--------+-------+-----------------------+ -10 rows in set (0.07 sec) \ No newline at end of file +10 rows in set (0.07 sec) +``` + +## Importing a Bitmap Containing Multiple Elements + +The following demonstrates two methods for importing a bitmap column containing multiple elements using stream load. Users can choose the appropriate method based on their source file format. + +### bitmap_from_string + +When using `bitmap_from_string`, square brackets are not allowed in the arr column of the source file. Otherwise, it will be considered a data quality error. + +```sql +1|koga|17,723 +2|nijg|146,285 +3|lojn|347,890 +4|lofn|489,871 +5|jfin|545,679 +6|kon|676,724 +7|nhga|767,689 +8|nfubg|879,878 +9|huang|969,798 +10|buag|97,997 +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr,arr=bitmap_from_string(arr)" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` + +### bitmap_from_array + +When using `bitmap_from_array`, the source file can contain square brackets in the arr column. However, in stream load, the string type must first be cast to an array type before use. +If the cast conversion is not applied, an error will occur due to the function signature not being found: `[ANALYSIS_ERROR]TStatus: errCode = 2, detailMessage = Does not support non-builtin functions, or function does not exist: bitmap_from_array(<slot 8>)` + +```sql +1|koga|[17,723] +2|nijg|[146,285] +3|lojn|[347,890] +4|lofn|[489,871] +5|jfin|[545,679] +6|kon|[676,724] +7|nhga|[767,689] +8|nfubg|[879,878] +9|huang|[969,798] +10|buag|[97,997] +``` + +Command for stream load + +```sql +curl --location-trusted -u <doris_user>:<doris_password> \ + -H "column_separator:|" \ + -H "columns:typ_id,hou,arr_str,arr=bitmap_from_array(cast(arr_str as array<int>))" \ + -T test_bitmap.csv \ + -XPUT http://<fe_ip>:<fe_http_port>/api/testdb/test_bitmap/_stream_load +``` --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org