[ 
https://issues.apache.org/jira/browse/CALCITE-6956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chuxin Chen updated CALCITE-6956:
---------------------------------
    Description: 
Hello, I want to support HyperLogLog for redis adapter.

HyperLogLog is a data type in Redis designed for efficient cardinality 
estimation. After adding multiple elements to a key using `PFADD`, you can 
calculate the cardinality using `PFCOUNT`.  

I plan to implement it as follows:  
```json
{
  "name": "uv_stats",
  "factory": "org.apache.calcite.adapter.redis.RedisTableFactory",
  "operand": {
    "dataFormat": "hyperloglog",
    "keyPattern": "uv:*",
    "fields": [
      {
        "name": "key",
        "type": "varchar"
      },
      {
        "name": "CARDINAL_NUMBER",
        "type": "long"
      }
    ]
  }
}
```
This configuration will:  
1. Use wildcard matching (`uv:*`) to scan all HyperLogLog keys  
2. Calculate the cardinality of each key via `PFCOUNT`  
3. Display results in the format:  
```
| -- key --|--CARDINAL_NUMBER--|
| uv:20250411 | 4 |
| uv:20250410 | 3 |
```


> Support HyperLogLog for redis adapter
> -------------------------------------
>
>                 Key: CALCITE-6956
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6956
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Chuxin Chen
>            Priority: Major
>
> Hello, I want to support HyperLogLog for redis adapter.
> HyperLogLog is a data type in Redis designed for efficient cardinality 
> estimation. After adding multiple elements to a key using `PFADD`, you can 
> calculate the cardinality using `PFCOUNT`.  
> I plan to implement it as follows:  
> ```json
> {
>   "name": "uv_stats",
>   "factory": "org.apache.calcite.adapter.redis.RedisTableFactory",
>   "operand": {
>     "dataFormat": "hyperloglog",
>     "keyPattern": "uv:*",
>     "fields": [
>       {
>         "name": "key",
>         "type": "varchar"
>       },
>       {
>         "name": "CARDINAL_NUMBER",
>         "type": "long"
>       }
>     ]
>   }
> }
> ```
> This configuration will:  
> 1. Use wildcard matching (`uv:*`) to scan all HyperLogLog keys  
> 2. Calculate the cardinality of each key via `PFCOUNT`  
> 3. Display results in the format:  
> ```
> | -- key --|--CARDINAL_NUMBER--|
> | uv:20250411 | 4 |
> | uv:20250410 | 3 |
> ```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to