Skip to content

Commit db3f26a

Browse files
authored
fix named collections and add sharding_expr (#646)
1 parent 7934341 commit db3f26a

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/append-stream.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ORDER BY <expression>
2424
COMMENT '<stream-comment>'
2525
SETTINGS
2626
shards=<num_of_shards>,
27+
sharding_expr='<expr>',
2728
replication_factor=<replication_factor>,
2829
mode=['append'|'changelog_kv'|'versioned_kv'],
2930
version_column=<version_column>,
@@ -178,6 +179,14 @@ Increasing the shard count typically improves performance for ingestion and quer
178179

179180
**Default**: `1`
180181

182+
#### `sharding_expr`
183+
184+
An arbitrary SQL expression that evaluates to an integer.
185+
186+
When a stream has more than one shard (`shards > 1`), `sharding_expr` determines how each ingested batch of rows is partitioned across the target shards. If no `PRIMARY KEY` is specified, it defaults to `rand()`; otherwise it defaults to `weak_hash32((primary key columns))`. You can override the sharding expression by setting it explicitly, for example `sharding_expr='city_hash64(session_id)'`.
187+
188+
**Default**: `rand()`
189+
181190
#### `replication_factor`
182191

183192
The number of replicas to maintain for high availability in a cluster deployment.

docs/named-collection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ There is also no setting validation as performed in stream creation. Setting inv
5252

5353
### Show Named Collections
5454

55-
Users with SELECT permission on `system.named_collection` can query all the named collections with their name, key/values and creation query.
55+
Users with SELECT permission on `system.named_collections` can query all the named collections with their name, key/values and creation query.
5656

5757
```sql
58-
SELECT * FROM system.named_collection
58+
SELECT * FROM system.named_collections
5959
```
6060

6161
### Drop Named Collection

0 commit comments

Comments
 (0)