-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Docs] update data types doc and fix some typo #4652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| { | ||
| "title": "BITMAP", | ||
| "language": "en" | ||
| } | ||
| --- | ||
|
|
||
| <!-- | ||
| 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 | ||
| ## Description | ||
| BITMAP | ||
|
|
||
| BITMAP cannot be used as a key column, and the aggregation type is BITMAP_UNION when building the table. | ||
| The user does not need to specify the length and default value. The length is controlled within the system according to the degree of data aggregation. | ||
| And the BITMAP column can only be queried or used by supporting functions such as bitmap_union_count, bitmap_union, and bitmap_hash. | ||
|
|
||
| The use of BITMAP in offline scenarios will affect the import speed. In the case of a large amount of data, the query speed will be slower than HLL and better than Count Distinct. | ||
| In the real-time scene, BITMAP cannot achieve complete and accurate deduplication, and the error is usually less than one thousandth. | ||
|
|
||
| ## example | ||
|
|
||
| select hour, BITMAP_UNION_COUNT(pv) over(order by hour) uv from( | ||
| select hour, BITMAP_UNION(device_id) as pv | ||
| from metric_table -- Query the accumulated UV per hour | ||
| where datekey=20200922 | ||
| group by hour order by 1 | ||
| ) final; | ||
|
|
||
| ## keyword | ||
| BITMAP |
35 changes: 0 additions & 35 deletions
35
docs/en/sql-reference/sql-statements/Data Types/HLL(HyperLogLog).md
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| { | ||
| "title": "HLL (HyperLogLog)", | ||
| "language": "en" | ||
| } | ||
| --- | ||
|
|
||
| <!-- | ||
| 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. | ||
| --> | ||
|
|
||
| #HLL (HyperLogLog) | ||
| ## Description | ||
| HLL | ||
|
|
||
| HLL cannot be used as a key column, and the aggregation type is HLL_UNION when create table. | ||
| The user does not need to specify the length and default value. | ||
| The length is controlled within the system according to the degree of data aggregation. | ||
| And HLL columns can only be queried or used through the matching hll_union_agg, hll_raw_agg, hll_cardinality, and hll_hash. | ||
|
|
||
| HLL is approximate count of distinct elements, and its performance is better than Count Distinct when the amount of data is large. | ||
| The error of HLL is usually around 1%, sometimes up to 2%. | ||
|
|
||
| ## example | ||
|
|
||
| select hour, HLL_UNION_AGG(pv) over(order by hour) uv from( | ||
| select hour, HLL_RAW_AGG(device_id) as pv | ||
| from metric_table -- Query the accumulated UV per hour | ||
| where datekey=20200922 | ||
| group by hour order by 1 | ||
| ) final; | ||
|
|
||
| ## keyword | ||
| HLL,HYPERLOGLOG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
docs/zh-CN/sql-reference/sql-statements/Data Types/BITMAP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| { | ||
| "title": "BITMAP", | ||
| "language": "zh-CN" | ||
| } | ||
| --- | ||
|
|
||
| <!-- | ||
| 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 | ||
| ## description | ||
| BITMAP | ||
| BITMAP不能作为key列使用,建表时配合聚合类型为BITMAP_UNION。 | ||
| 用户不需要指定长度和默认值。长度根据数据的聚合程度系统内控制。 | ||
| 并且BITMAP列只能通过配套的bitmap_union_count、bitmap_union、bitmap_hash等函数进行查询或使用。 | ||
|
|
||
| 离线场景下使用BITMAP会影响导入速度,在数据量大的情况下查询速度会慢于HLL,并优于Count Distinct。 | ||
| 实时场景下BITMAP也不能做到完全的精确去重,通常误差小于千分之一。 | ||
|
|
||
| ## example | ||
|
|
||
| select hour, BITMAP_UNION_COUNT(pv) over(order by hour) uv from( | ||
| select hour, BITMAP_UNION(device_id) as pv | ||
| from metric_table -- 查询每小时的累计UV | ||
| where datekey=20200622 | ||
| group by hour order by 1 | ||
| ) final; | ||
|
|
||
| ## keyword | ||
|
|
||
| BITMAP | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么bitmap在实时场景下不能做到精确去重呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实时场景下的BITMAP,通常不会引入全局字典,因为当全局字典大了之后时延很大,实时的吞吐和时延都会明显下降。导致查询和更新全局字典的成本和时延很高,会极大降低实时导入的性能。
这块文档需要特别说明一下吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦,这个描述不太准确。bitmap这个类型本身是精确的。只是在“实时场景”下,用户导入的数据本身是不精确的。比如不使用全局字典,或者使用了 bitmap_hash() 等函数导致的误差,这些和bitmap本身的实现无关。这个需要说明下。