techdocsmith commented on code in PR #17658:
URL: https://github.com/apache/druid/pull/17658#discussion_r1942048189
##########
docs/querying/sql-functions.md:
##########
@@ -1282,22 +1282,75 @@ Returns the following:
## BLOOM_FILTER
-Computes a Bloom filter from values produced by the specified expression.
+Computes a [Bloom filter](../development/extensions-core/bloom-filter.md) from
values provided in an expression.
-* **Syntax**: `BLOOM_FILTER(expr, <NUMERIC>)`
+
+* **Syntax:** `BLOOM_FILTER(expr, numEntries)`
+ `numEntries` specifies the maximum number of distinct values before the
false positive rate increases.
* **Function type:** Aggregation
+<details><summary>Example</summary>
+
+The following example returns a Base64-encoded Bloom filter string for entries
in `agent_category`:
+
+```sql
+SELECT
+ agent_category,
+ BLOOM_FILTER(agent_category, 10) as bloom
+FROM "kttm"
+ GROUP BY agent_category
+```
+
+Returns the following:
+
+| `agent_keys` | `bloom` |
+| -- | -- |
+| `empty` |
`"BAAAAAgAAAAAABAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAAAAAA"`
|
+| `Game console` |
`"BAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBAAAAAAAAAAAAAAAA"`
|
+| `Personal computer` |
`"BAAAAAgAAAAAAEAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA"`
|
+| `Smart TV` |
`"BAAAAAgAAAAAAAAAAAAAgAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAA"`
|
+| `Smartphone` |
`"BAAAAAgAAACAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAA"`
|
+| `Tablet` |
`"BAAAAAgAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAIA"`
|
+
Review Comment:
`````suggestion
The following example returns a Base64-encoded Bloom filter representing the
set of devices ,`agent_category`, used in Albania:
```sql
SELECT "country",
BLOOM_FILTER(agent_category, 10) as albanian_bloom
FROM "kttm"
WHERE "country" = 'Albania'
GROUP BY "country"
```
Returns the following:
|`country`| `albanian_bloom`|
|---| --- |
|`Albania`|`BAAAAAgAAACAAEAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAIIAAAAAAAAAAAAAAAAAAIAAAAAAQAAAAAAAAAAAAAA`|
`````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]