Skip to content

Commit d7ed15b

Browse files
authored
Merge branch 'main' into distributed_insert
2 parents 85c39f7 + c3abc4a commit d7ed15b

File tree

60 files changed

+2393
-1050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2393
-1050
lines changed

.github/actions/test_sqllogic_cluster_linux/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ runs:
2828
run: |
2929
docker run --rm --tty --net=host \
3030
--user $(id -u):$(id -g) \
31+
--env BUILD_PROFILE \
3132
--volume "${PWD}:/workspace" \
3233
--workdir "/workspace" \
3334
datafuselabs/build-tool:sqllogic \

.github/actions/test_sqllogic_standalone_linux/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ runs:
2828
run: |
2929
docker run --rm --tty --net=host \
3030
--user $(id -u):$(id -g) \
31+
--env BUILD_PROFILE \
3132
--volume "${PWD}:/workspace" \
3233
--workdir "/workspace" \
3334
datafuselabs/build-tool:sqllogic \

.github/actions/test_sqllogic_standalone_macos/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,3 @@ runs:
3232
shell: bash
3333
run: |
3434
bash ./scripts/ci/ci-run-sqllogic-tests.sh ${{ inputs.dirs }}
35-
36-
# - name: Upload failure
37-
# if: failure()
38-
# uses: ./.github/actions/artifact_failure
39-
# with:
40-
# name: test-sqllogic-standalone-macos

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/doc/30-reference/20-functions/40-string-functions/substring.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ SUBSTRING(str FROM pos FOR len)
2424
| Arguments | Description |
2525
| ----------- | ----------- |
2626
| str | The main string from where the character to be extracted |
27-
| pos | The one-indexed position expression to start at. If negative, counts from the end |
28-
| len | The number expression of characters to extract |
27+
| pos | The position (starting from 1) the substring to start at. If negative, counts from the end |
28+
| len | The maximun length of the substring to extract |
2929

3030
## Return Type
3131

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"label": "Cluster Key",
3-
"link": {
4-
"type": "generated-index",
5-
"slug": "/reference/sql/ddl/clusterkey"
6-
}
2+
"label": "Cluster Key"
73
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: What is a Cluster Key?
3+
sidebar_position: 1
4+
slug: ./
5+
---
6+
7+
The cluster key is a data object for tables in Databend. It explicitly tells Databend how to divide and group rows of a table into the storage partitions rather than using the data ingestion order.
8+
9+
A table's cluster key is usually one or more columns or expressions. If you define a cluster key for a table, Databend reorganizes your data based on the cluster key and stores similar rows into the same or adjacent storage partitions.
10+
11+
The benefit of defining a cluster key is optimizing the query performance. The cluster key acts as a link between the metadata in the Databend's Meta Service Layer and the storage partitions. After the cluster key is defined for a table, the table's metadata implements a key-value-like list that shows the correspondences between the column or expression values and their storage partitions. When a query comes, Databend can quickly locate the storage partition by the metadata and fetch the results. To make this work, the cluster key you set must match the way how you filter the data in queries. For example, if you're most likely to query a table that holds all the employees' profile information by their first names, set the cluster key to the first name column.
12+
13+
In Databend, you [SET CLUSTER KEY](dml-set-cluster-key.md) when you create a table, and you can [ALTER CLUSTER KEY](https://databend.rs/doc/reference/sql/ddl/clusterkey/dml-alter-cluster-key) if necessary. A fully-clustered table might become chaotic if it continues to have ingestion or Data Manipulation Language operations (such as INSERT, UPDATE, DELETE), you will need to [RECLUSTER TABLE](./dml-recluster-table.md) to fix the chaos.
14+
15+
It's important to note that, most of the time you do not need to set the cluster key. Clustering or re-clustering a table consumes time and your credits if you're in Databend Cloud. Databend recommends setting cluster keys for large tables with slow query issues.

src/meta/api/src/kv_api_key.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ pub enum KVApiKeyError {
3030
#[error("Expect {expect} segments, but: '{got}'")]
3131
WrongNumberOfSegments { expect: usize, got: String },
3232

33+
#[error("Expect at least {expect} segments, but {actual} segments found")]
34+
AtleastSegments { expect: usize, actual: usize },
35+
3336
#[error("Invalid id string: '{s}': {reason}")]
3437
InvalidId { s: String, reason: String },
3538
}

src/meta/api/src/kv_api_test_suite.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ impl KVApiTestSuite {
483483
key: txn_key.clone(),
484484
value: b"new_v1".to_vec(),
485485
prev_value: true,
486+
expire_at: None,
486487
})),
487488
}];
488489

@@ -640,6 +641,7 @@ impl KVApiTestSuite {
640641
key: txn_key.clone(),
641642
value: b"new_v1".to_vec(),
642643
prev_value: true,
644+
expire_at: None,
643645
})),
644646
}];
645647

@@ -691,6 +693,7 @@ impl KVApiTestSuite {
691693
key: txn_key1.clone(),
692694
value: b"new_v1".to_vec(),
693695
prev_value: true,
696+
expire_at: None,
694697
})),
695698
}];
696699

@@ -745,6 +748,7 @@ impl KVApiTestSuite {
745748
key: txn_key1.clone(),
746749
value: val1_new.to_vec(),
747750
prev_value: true,
751+
expire_at: None,
748752
})),
749753
},
750754
// change k2
@@ -753,6 +757,7 @@ impl KVApiTestSuite {
753757
key: txn_key2.clone(),
754758
value: b"new_v2".to_vec(),
755759
prev_value: true,
760+
expire_at: None,
756761
})),
757762
},
758763
// get k1
@@ -852,6 +857,7 @@ impl KVApiTestSuite {
852857
key: txn_key1.clone(),
853858
value: val1_new.to_vec(),
854859
prev_value: true,
860+
expire_at: None,
855861
})),
856862
},
857863
// get k1

src/meta/api/src/kv_api_utils.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,18 @@ pub fn txn_op_put(key: &impl KVApiKey, value: Vec<u8>) -> TxnOp {
226226
key: key.to_key(),
227227
value,
228228
prev_value: true,
229+
expire_at: None,
230+
})),
231+
}
232+
}
233+
234+
pub fn txn_op_put_with_expire(key: &impl KVApiKey, value: Vec<u8>, expire_at: u64) -> TxnOp {
235+
TxnOp {
236+
request: Some(Request::Put(TxnPutRequest {
237+
key: key.to_key(),
238+
value,
239+
prev_value: true,
240+
expire_at: Some(expire_at),
229241
})),
230242
}
231243
}

0 commit comments

Comments
 (0)