Skip to content

Commit bb69a39

Browse files
authored
Merge branch 'main' into stage_table
2 parents 11c96bc + e41890f commit bb69a39

File tree

138 files changed

+3117
-836
lines changed

Some content is hidden

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

138 files changed

+3117
-836
lines changed

.github/actions/build_linux/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
uses: ./.github/actions/setup_build_tool
1515
with:
1616
image: ${{ inputs.target }}
17-
bypass_env_vars: RUSTFLAGS,RUST_LOG,RUSTC_WRAPPER,SCCACHE_BUCKET,SCCACHE_S3_KEY_PREFIX,SCCACHE_S3_USE_SSL,AWS_DEFAULT_REGION,AWS_REGION,AWS_ROLE_ARN,AWS_STS_REGIONAL_ENDPOINTS,AWS_WEB_IDENTITY_TOKEN_FILE
17+
bypass_env_vars: RUSTFLAGS,RUST_LOG,RUSTC_WRAPPER,SCCACHE_BUCKET,SCCACHE_S3_KEY_PREFIX,SCCACHE_S3_USE_SSL,AWS_DEFAULT_REGION,AWS_REGION,AWS_ROLE_ARN,AWS_STS_REGIONAL_ENDPOINTS,AWS_WEB_IDENTITY_TOKEN_FILE,je_cv_pthread_getname_np
1818

1919
- name: Build Debug
2020
if: inputs.profile == 'debug'

.github/auto_assign.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/dev-linux.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ jobs:
6464
# fetch all tags, metasrv and metaclient need tag as its version.
6565
fetch-depth: 0
6666
- uses: ./.github/actions/build_linux
67+
env:
68+
# To avoid the `undefined reference to pthread_getname_np` error during linking,
69+
# here we override set config environment var `je_cv_pthread_getname_np` to `no`,
70+
# as suggested by tikv-jemalloc-sys's maintainer @BusyJay:
71+
# https://github.com/tikv/jemallocator/issues/30#issuecomment-1183786410
72+
#
73+
# Hopefully this trick can be removed when rust upgraded to musl 1.2.3
74+
# https://github.com/rust-lang/rust/pull/102891
75+
je_cv_pthread_getname_np: no
6776
with:
6877
target: ${{ matrix.arch }}-unknown-linux-musl
6978
profile: debug

Cargo.lock

Lines changed: 34 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ members = [
5858
"src/query/storages/stage",
5959
"src/query/storages/system",
6060
"src/query/storages/view",
61+
"src/query/storages/parquet",
6162
"src/query/users",
6263
# databend-query
6364
"src/query/service",

docs/doc/10-deploy/06-metasrv/30-metasrv-backup-restore.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ This guideline will introduce how to back up and restore the meta service cluste
99

1010
## Export Data From Meta Service
1111

12+
It supports to export from a databend-meta data dir or from a running databend-meta server.
13+
14+
### Export from data dir
15+
1216
Shutdown the `databend-meta` service.
1317

1418
Then export sled DB from the dir(`<your_meta_dir>`) in which the `databend-meta` stores meta to a local file `output_fn`, in multi-line JSON format.
@@ -29,6 +33,20 @@ E.g., every line in the output file is a JSON of an exported key-value record.
2933

3034
Note: without the `--db` argument, the exported data will output to the stdio instead.
3135

36+
### Export from a running server
37+
38+
Similar to exporting from data dir, but with the service endpoint argument `--grpc-api-address <ip:port>` in place of the `--raft-dir`,
39+
where `<ip:port>` is the `grpc_api_address` in [databend-meta config.toml](./15-metasrv-config.md), e.g.:
40+
41+
```shell
42+
./target/debug/databend-metactl --export --grpc-api-address "127.0.0.1:9191" --db <output_fn>
43+
44+
# tail "<output_fn>"
45+
# ["state_machine/0",{"Nodes":{"key":2,"value":{"name":"","endpoint":{"addr":"localhost","port":28203}}}}]
46+
# ...
47+
```
48+
49+
3250
## Restore a databend-meta
3351

3452
The following command rebuild a meta service db in `<your_meta_dir>` from
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: RESTORE TABLE
3+
---
4+
5+
Restores a table to an earlier version with a snapshot ID or timestamp.
6+
7+
By the snapshot ID or timestamp you specify in the command, Databend restores the table to a prior state where the snapshot was created. To retrieve snapshot IDs and timestamps of a table, use [FUSE_SNAPSHOT](../../../15-sql-functions/111-system-functions/fuse_snapshot.md).
8+
9+
The capability to restore a table is subject to these conditions:
10+
11+
- The command only restores existing tables to their prior states. To recover a dropped table, use [UNDROP TABLE](21-ddl-undrop-table.md).
12+
13+
- Restoring a table is part of Databend's time travel feature. Before using the command, make sure the table you want to restore is eligible for time travel. For example, the command doesn't work for transient tables because Databend does not create or store snapshots for such tables.
14+
15+
- You cannot roll back after restoring a table to a prior state, but you can restore the table again to an earlier state.
16+
17+
- Databend recommends this command for emergency recovery only. To query the history data of a table, use the [AT](../../20-query-syntax/dml-at.md) clause.
18+
19+
## Syntax
20+
21+
```sql
22+
-- Restore with a snapshot ID
23+
ALTER TABLE <table> FLASHBACK TO (SNAPSHOT => '<snapshot-id>');
24+
25+
-- Restore with a snapshot timestamp
26+
ALTER TABLE <table> FLASHBACK TO (TIMESTAMP => '<timestamp>'::TIMESTAMP);
27+
```
28+
29+
## Examples
30+
31+
```sql
32+
CREATE TABLE mytable(a int);
33+
34+
INSERT INTO mytable VALUES(1);
35+
INSERT INTO mytable VALUES(2);
36+
INSERT INTO mytable VALUES(3);
37+
38+
SELECT * FROM mytable;
39+
40+
a|
41+
-+
42+
3|
43+
2|
44+
1|
45+
46+
-- Retrieve snapshot information
47+
SELECT snapshot_id, timestamp FROM FUSE_SNAPSHOT('default','mytable');
48+
49+
snapshot_id |timestamp |
50+
--------------------------------+-----------------------------+
51+
2648bee0e85044f9879e71f1d37f453b|2022-12-06 20:50:53.324485000|
52+
7e5d4f7ebdbc44d08116771193533346|2022-12-06 20:50:23.623331000|
53+
41c94c7ea47a432388770ada0a66b6c0|2022-12-06 20:49:56.125918000|
54+
55+
-- Restore with a snapshot ID
56+
ALTER TABLE mytable FLASHBACK TO (SNAPSHOT => '7e5d4f7ebdbc44d08116771193533346');
57+
58+
SELECT * FROM mytable;
59+
60+
a|
61+
-+
62+
2|
63+
1|
64+
65+
-- Restore with a snapshot timestamp
66+
ALTER TABLE mytable FLASHBACK TO (TIMESTAMP => '2022-12-06 20:49:56.125918000'::TIMESTAMP);
67+
68+
SELECT * FROM mytable;
69+
70+
a|
71+
-+
72+
1|
73+
```

docs/doc/14-sql-commands/20-query-syntax/dml-select.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ SELECT
1111
[ALL | DISTINCT]
1212
select_expr [[AS] alias], ...
1313
[INTO variable [, ...]]
14-
[ FROM table_references
14+
[EXCLUDE (col_name1 [, col_name2, col_name3, ...] ) ]
15+
[FROM table_references
1516
[AT ...]
1617
[WHERE expr]
1718
[GROUP BY {{col_name | expr | col_alias | col_position}, ...
@@ -22,6 +23,7 @@ SELECT
2223
[OFFSET row_count]
2324
[IGNORE_RESULT]
2425
]
26+
]
2527
```
2628

2729
:::tip
@@ -41,6 +43,47 @@ SELECT number FROM numbers(3);
4143
+--------+
4244
```
4345

46+
### EXCLUDE Parameter
47+
48+
Excludes one or more columns by their names from the result. The parameter is usually used in conjunction with `SELECT * ...` to exclude a few columns from the result instead of retrieving them all.
49+
50+
```sql
51+
SELECT * FROM allemployees ORDER BY id;
52+
53+
---
54+
| id | firstname | lastname | gender |
55+
|----|-----------|----------|--------|
56+
| 1 | Ryan | Tory | M |
57+
| 2 | Oliver | Green | M |
58+
| 3 | Noah | Shuster | M |
59+
| 4 | Lily | McMent | F |
60+
| 5 | Macy | Lee | F |
61+
62+
-- Exclude the column "id" from the result
63+
SELECT * EXCLUDE id FROM allemployees;
64+
65+
---
66+
| firstname | lastname | gender |
67+
|-----------|----------|--------|
68+
| Noah | Shuster | M |
69+
| Ryan | Tory | M |
70+
| Oliver | Green | M |
71+
| Lily | McMent | F |
72+
| Macy | Lee | F |
73+
74+
-- Exclude the columns "id" and "lastname" from the result
75+
SELECT * EXCLUDE (id,lastname) FROM allemployees;
76+
77+
---
78+
| firstname | gender |
79+
|-----------|--------|
80+
| Oliver | M |
81+
| Ryan | M |
82+
| Lily | F |
83+
| Noah | M |
84+
| Macy | F |
85+
```
86+
4487
## FROM Clause
4588

4689
```sql

0 commit comments

Comments
 (0)