Skip to content

Commit a60877e

Browse files
authored
Merge branch 'main' into Kleene-logic-and
2 parents 1be036b + 985d6f8 commit a60877e

File tree

242 files changed

+2717
-1518
lines changed

Some content is hidden

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

242 files changed

+2717
-1518
lines changed

Cargo.lock

Lines changed: 124 additions & 100 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
@@ -30,6 +30,7 @@ members = [
3030
"src/query/functions-v2",
3131
"src/query/legacy-parser",
3232
"src/query/management",
33+
"src/query/planner",
3334
"src/query/pipeline/core",
3435
"src/query/pipeline/sinks",
3536
"src/query/pipeline/sources",

docker/debian/meta.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ RUN apt-get update -y && \
99
rm -rf /var/cache/apt/*
1010

1111
COPY ./distro/$TARGETPLATFORM/databend-meta /databend-meta
12+
COPY ./distro/$TARGETPLATFORM/databend-metactl /databend-metactl
1213
ENTRYPOINT ["/databend-meta"]

docker/distroless/meta.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM gcr.io/distroless/cc
22
ARG TARGETPLATFORM
33
COPY ./distro/$TARGETPLATFORM/databend-meta /databend-meta
4+
COPY ./distro/$TARGETPLATFORM/databend-metactl /databend-metactl
45
ENTRYPOINT ["/databend-meta"]

docs/doc/30-reference/20-functions/111-system-functions/fuse_snapshot.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ INSERT INTO mytable VALUES(4,4);
2222
SELECT * FROM FUSE_SNAPSHOT('default','mytable');
2323

2424
---
25-
| snapshot_id | snapshot_location | format_version | previous_snapshot_id | segment_count | block_count | row_count | bytes_uncompressed | bytes_compressed | timestamp |
26-
|----------------------------------|------------------------------------------------------------|----------------|----------------------------------|---------------|-------------|-----------|--------------------|------------------|----------------------------|
27-
| dd98266f968f4817b470255592d04fda | 670655/670675/_ss/dd98266f968f4817b470255592d04fda_v1.json | 1 | \N | 1 | 1 | 2 | 16 | 290 | 2022-09-07 01:58:55.204997 |
28-
| 2f2d004ff6f842cdb25f5631b2bbb703 | 670655/670675/_ss/2f2d004ff6f842cdb25f5631b2bbb703_v1.json | 1 | dd98266f968f4817b470255592d04fda | 2 | 2 | 4 | 32 | 580 | 2022-09-07 01:59:09.742999 |
29-
| 0aa6dfd5d5364bde80f21161ba48c96e | 670655/670675/_ss/0aa6dfd5d5364bde80f21161ba48c96e_v1.json | 1 | 2f2d004ff6f842cdb25f5631b2bbb703 | 3 | 3 | 5 | 40 | 862 | 2022-09-07 01:59:16.858454 |
25+
| snapshot_id | snapshot_location | format_version | previous_snapshot_id | segment_count | block_count | row_count | bytes_uncompressed | bytes_compressed | index_size | timestamp |
26+
|----------------------------------|------------------------------------------------------------|----------------|----------------------------------|---------------|-------------|-----------|--------------------|------------------|------------|----------------------------|
27+
| a13d211b7421432898a3786848b8ced3 | 670655/783287/_ss/a13d211b7421432898a3786848b8ced3_v1.json | 1 | \N | 1 | 1 | 2 | 16 | 290 | 363 | 2022-09-19 14:51:52.860425 |
28+
| cf08e6af6c134642aeb76bc81e6e7580 | 670655/783287/_ss/cf08e6af6c134642aeb76bc81e6e7580_v1.json | 1 | a13d211b7421432898a3786848b8ced3 | 2 | 2 | 4 | 32 | 580 | 726 | 2022-09-19 14:52:15.282943 |
29+
| 1bd4f68b831a402e8c42084476461aa1 | 670655/783287/_ss/1bd4f68b831a402e8c42084476461aa1_v1.json | 1 | cf08e6af6c134642aeb76bc81e6e7580 | 3 | 3 | 5 | 40 | 862 | 1085 | 2022-09-19 14:52:20.284347 |
3030
```

docs/doc/30-reference/30-sql/40-show/show-table-status.md

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
title: SHOW TABLE STATUS
33
---
44

5-
Shows the list of table status in the currently selected database.
5+
Shows the status of the tables in a database. The status information includes various physical sizes and timestamps about a table, see [Examples](#examples) for details.
6+
7+
The command returns status information of all the tables in the current database by default. Use a FROM | IN clause to specify another database rather than the current one. You can also filter tables with a LIKE or WHERE clause.
68

79
## Syntax
810

9-
```
11+
```sql
1012
SHOW TABLE STATUS
1113
[{FROM | IN} db_name]
1214
[LIKE 'pattern' | WHERE expr]
@@ -16,17 +18,19 @@ SHOW TABLE STATUS
1618

1719
```sql
1820
CREATE TABLE t(id INT);
19-
SHOW TABLE STATUS\G
21+
22+
-- Show status of all tables in the current database
23+
SHOW TABLE STATUS;
2024
*************************** 1. row ***************************
2125
Name: t
2226
Engine: FUSE
2327
Version: 0
2428
Row_format: NULL
25-
Rows: NULL
29+
Rows: 0
2630
Avg_row_length: NULL
27-
Data_length: NULL
31+
Data_length: 0
2832
Max_data_length: NULL
29-
Index_length: NULL
33+
Index_length: 0
3034
Data_free: NULL
3135
Auto_increment: NULL
3236
Create_time: 2022-04-08 04:13:48.988 +0000
@@ -37,19 +41,20 @@ Max_data_length: NULL
3741
Comment:
3842
```
3943

40-
Showing the tables with table name `"t"`:
44+
The following returns status information of the table named "t":
45+
4146
```sql
42-
SHOW TABLE STATUS LIKE 't'\G
47+
SHOW TABLE STATUS LIKE 't';
4348
*************************** 1. row ***************************
4449
Name: t
4550
Engine: FUSE
4651
Version: 0
4752
Row_format: NULL
48-
Rows: NULL
53+
Rows: 0
4954
Avg_row_length: NULL
50-
Data_length: NULL
55+
Data_length: 0
5156
Max_data_length: NULL
52-
Index_length: NULL
57+
Index_length: 0
5358
Data_free: NULL
5459
Auto_increment: NULL
5560
Create_time: 2022-04-08 04:13:48.988 +0000
@@ -60,42 +65,44 @@ Max_data_length: NULL
6065
Comment:
6166
```
6267

63-
Showing the tables begin with `"t"`:
68+
The following uses a LIKE clause to return status information of the tables with a name starting with "t":
69+
6470
```sql
65-
SHOW TABLE STATUS LIKE 't%'\G
71+
SHOW TABLE STATUS LIKE 't%';
6672
*************************** 1. row ***************************
6773
Name: t
6874
Engine: FUSE
6975
Version: 0
7076
Row_format: NULL
71-
Rows: NULL
77+
Rows: 0
7278
Avg_row_length: NULL
73-
Data_length: NULL
79+
Data_length: 0
7480
Max_data_length: NULL
75-
Index_length: NULL
81+
Index_length: 0
7682
Data_free: NULL
7783
Auto_increment: NULL
7884
Create_time: 2022-04-08 04:13:48.988 +0000
7985
Update_time: NULL
8086
Check_time: NULL
8187
Collation: NULL
8288
Checksum: NULL
83-
Comment:
89+
Comment:
8490
```
8591

86-
Showing the tables begin with `"t"` with `WHERE`:
92+
The following uses a WHERE clause to return status information of the tables with a name starting with "t":
93+
8794
```sql
88-
SHOW TABLE STATUS WHERE name LIKE 't%'\G
95+
SHOW TABLE STATUS WHERE name LIKE 't%';
8996
*************************** 1. row ***************************
9097
Name: t
9198
Engine: FUSE
9299
Version: 0
93100
Row_format: NULL
94-
Rows: NULL
101+
Rows: 0
95102
Avg_row_length: NULL
96-
Data_length: NULL
103+
Data_length: 0
97104
Max_data_length: NULL
98-
Index_length: NULL
105+
Index_length: 0
99106
Data_free: NULL
100107
Auto_increment: NULL
101108
Create_time: 2022-04-08 04:13:48.988 +0000
@@ -106,19 +113,20 @@ Max_data_length: NULL
106113
Comment:
107114
```
108115

109-
Showing the tables are inside `"default"`:
116+
The following returns status information of all tables in the database `default`:
117+
110118
```sql
111-
SHOW TABLE STATUS FROM 'default'\G
119+
SHOW TABLE STATUS FROM 'default';
112120
*************************** 1. row ***************************
113121
Name: t
114122
Engine: FUSE
115123
Version: 0
116124
Row_format: NULL
117-
Rows: NULL
125+
Rows: 0
118126
Avg_row_length: NULL
119-
Data_length: NULL
127+
Data_length: 0
120128
Max_data_length: NULL
121-
Index_length: NULL
129+
Index_length: 0
122130
Data_free: NULL
123131
Auto_increment: NULL
124132
Create_time: 2022-04-08 04:13:48.988 +0000
@@ -127,4 +135,4 @@ Max_data_length: NULL
127135
Collation: NULL
128136
Checksum: NULL
129137
Comment:
130-
```
138+
```

docs/doc/30-reference/30-sql/80-setting-cmds/show-settings.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,26 @@ SHOW SETTINGS;
1515
```sql
1616
SHOW SETTINGS;
1717

18-
|name |value |default|level |description |type |
19-
|------------------------------|-------|-------|-------|--------------------------------------------------------------------------------------------------|------|
20-
|compression |None |None |SESSION|Format compression, default value: None |String|
21-
|empty_as_default |1 |1 |SESSION|Format empty_as_default, default value: 1 |UInt64|
22-
|enable_async_insert |0 |0 |SESSION|Whether the client open async insert mode, default value: 0 |UInt64|
23-
|enable_new_processor_framework|1 |1 |SESSION|Enable new processor framework if value != 0, default value: 1 |UInt64|
24-
|enable_planner_v2 |0 |0 |SESSION|Enable planner v2 by setting this variable to 1, default value: 0 |UInt64|
25-
|field_delimiter |, |, |SESSION|Format field delimiter, default value: , |String|
26-
|flight_client_timeout |60 |60 |SESSION|Max duration the flight client request is allowed to take in seconds. By default, it is 60 seconds|UInt64|
27-
|group_by_two_level_threshold |10000 |10000 |SESSION|The threshold of keys to open two-level aggregation, default value: 10000 |UInt64|
28-
|max_block_size |10000 |10000 |SESSION|Maximum block size for reading |UInt64|
29-
|max_execute_time |0 |0 |SESSION|The maximum query execution time. it means no limit if the value is zero. default value: 0 |UInt64|
30-
|max_threads |4 |16 |SESSION|The maximum number of threads to execute the request. By default, it is determined automatically. |UInt64|
31-
|record_delimiter |¶ |¶ |SESSION|Format record_delimiter, default value: ¶ |String|
32-
|skip_header |0 |0 |SESSION|Whether to skip the input header, default value: 0 |UInt64|
33-
|storage_read_buffer_size |1048576|1048576|SESSION|The size of buffer in bytes for buffered reader of dal. By default, it is 1MB. |UInt64|
34-
|timezone |UTC |UTC |SESSION|Timezone, default value: UTC, |String|
35-
|wait_for_async_insert |1 |1 |SESSION|Whether the client wait for the reply of async insert, default value: 1 |UInt64|
36-
|wait_for_async_insert_timeout |100 |100 |SESSION|The timeout in seconds for waiting for processing of async insert, default value: 100 |UInt64|
18+
| name | value | default | level | description | type |
19+
|--------------------------------|------------|------------|---------|----------------------------------------------------------------------------------------------------|--------|
20+
| compression | None | None | SESSION | Format compression, default value: None | String |
21+
| empty_as_default | 1 | 1 | GLOBAL | Format empty_as_default, default value: 1 | UInt64 |
22+
| enable_async_insert | 0 | 0 | SESSION | Whether the client open async insert mode, default value: 0 | UInt64 |
23+
| enable_new_processor_framework | 1 | 1 | SESSION | Enable new processor framework if value != 0, default value: 1 | UInt64 |
24+
| enable_planner_v2 | 1 | 1 | SESSION | Enable planner v2 by setting this variable to 1, default value: 1 | UInt64 |
25+
| field_delimiter | , | , | SESSION | Format field delimiter, default value: , | String |
26+
| flight_client_timeout | 60 | 60 | SESSION | Max duration the flight client request is allowed to take in seconds. By default, it is 60 seconds | UInt64 |
27+
| group_by_two_level_threshold | 10000 | 10000 | SESSION | The threshold of keys to open two-level aggregation, default value: 10000 | UInt64 |
28+
| max_block_size | 10000 | 10000 | SESSION | Maximum block size for reading | UInt64 |
29+
| max_execute_time | 0 | 0 | SESSION | The maximum query execution time. it means no limit if the value is zero. default value: 0 | UInt64 |
30+
| max_threads | 8 | 16 | GLOBAL | The maximum number of threads to execute the request. By default, it is determined automatically. | UInt64 |
31+
| quoted_ident_case_sensitive | 1 | 1 | SESSION | Case sensitivity of quoted identifiers, default value: 1 (aka case-sensitive) | UInt64 |
32+
| record_delimiter | "\n" | "\n" | SESSION | Format record_delimiter, default value: "\n" | String |
33+
| skip_header | 1 | 0 | GLOBAL | Whether to skip the input header, default value: 0 | UInt64 |
34+
| sql_dialect | PostgreSQL | PostgreSQL | SESSION | SQL dialect, support "PostgreSQL" and "MySQL", default value: "PostgreSQL" | String |
35+
| storage_read_buffer_size | 1048576 | 1048576 | SESSION | The size of buffer in bytes for buffered reader of dal. By default, it is 1MB. | UInt64 |
36+
| timezone | UTC | UTC | SESSION | Timezone, default value: UTC, | String |
37+
| unquoted_ident_case_sensitive | 0 | 0 | SESSION | Case sensitivity of unquoted identifiers, default value: 0 (aka case-insensitive) | UInt64 |
38+
| wait_for_async_insert | 1 | 1 | SESSION | Whether the client wait for the reply of async insert, default value: 1 | UInt64 |
39+
| wait_for_async_insert_timeout | 100 | 100 | SESSION | The timeout in seconds for waiting for processing of async insert, default value: 100 | UInt64 |
3740
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2022 Datafuse Labs.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use common_exception::ErrorCode;
16+
use common_exception::Result;
17+
18+
pub fn catch_unwind<F: FnOnce() -> R, R>(f: F) -> Result<R> {
19+
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(f)) {
20+
Ok(res) => Ok(res),
21+
Err(cause) => match cause.downcast_ref::<&'static str>() {
22+
None => match cause.downcast_ref::<String>() {
23+
None => Err(ErrorCode::PanicError("Sorry, unknown panic message")),
24+
Some(message) => Err(ErrorCode::PanicError(message.to_string())),
25+
},
26+
Some(message) => Err(ErrorCode::PanicError(message.to_string())),
27+
},
28+
}
29+
}

src/common/base/src/base/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
mod catch_unwind;
1516
mod global_runtime;
1617
mod net;
1718
mod profiling;
@@ -27,6 +28,7 @@ mod string_func;
2728
mod thread;
2829
mod uniq_id;
2930

31+
pub use catch_unwind::catch_unwind;
3032
pub use global_runtime::GlobalIORuntime;
3133
pub use net::get_free_tcp_port;
3234
pub use net::get_free_udp_port;
@@ -53,6 +55,7 @@ pub use string_func::mask_string;
5355
pub use string_func::replace_nth_char;
5456
pub use string_func::unescape_for_key;
5557
pub use thread::Thread;
58+
pub use thread::ThreadJoinHandle;
5659
pub use tokio;
5760
pub use uniq_id::GlobalSequence;
5861
pub use uniq_id::GlobalUniqName;

src/common/base/src/base/thread.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,38 @@
1515
use std::thread::Builder;
1616
use std::thread::JoinHandle;
1717

18+
use common_exception::ErrorCode;
19+
use common_exception::Result;
20+
1821
use super::runtime_tracker::ThreadTracker;
1922

2023
pub struct Thread;
2124

25+
pub struct ThreadJoinHandle<T> {
26+
inner: JoinHandle<T>,
27+
}
28+
29+
impl<T> ThreadJoinHandle<T> {
30+
pub fn create(inner: JoinHandle<T>) -> ThreadJoinHandle<T> {
31+
ThreadJoinHandle { inner }
32+
}
33+
34+
pub fn join(self) -> Result<T> {
35+
match self.inner.join() {
36+
Ok(res) => Ok(res),
37+
Err(cause) => match cause.downcast_ref::<&'static str>() {
38+
None => match cause.downcast_ref::<String>() {
39+
None => Err(ErrorCode::PanicError("Sorry, unknown panic message")),
40+
Some(message) => Err(ErrorCode::PanicError(message.to_string())),
41+
},
42+
Some(message) => Err(ErrorCode::PanicError(message.to_string())),
43+
},
44+
}
45+
}
46+
}
47+
2248
impl Thread {
23-
pub fn named_spawn<F, T>(mut name: Option<String>, f: F) -> JoinHandle<T>
49+
pub fn named_spawn<F, T>(mut name: Option<String>, f: F) -> ThreadJoinHandle<T>
2450
where
2551
F: FnOnce() -> T,
2652
F: Send + 'static,
@@ -42,18 +68,18 @@ impl Thread {
4268
thread_builder = thread_builder.name(named);
4369
}
4470

45-
match ThreadTracker::current_runtime_tracker() {
71+
ThreadJoinHandle::create(match ThreadTracker::current_runtime_tracker() {
4672
None => thread_builder.spawn(f).unwrap(),
4773
Some(runtime_tracker) => thread_builder
4874
.spawn(move || {
4975
ThreadTracker::create(runtime_tracker);
5076
f()
5177
})
5278
.unwrap(),
53-
}
79+
})
5480
}
5581

56-
pub fn spawn<F, T>(f: F) -> JoinHandle<T>
82+
pub fn spawn<F, T>(f: F) -> ThreadJoinHandle<T>
5783
where
5884
F: FnOnce() -> T,
5985
F: Send + 'static,

0 commit comments

Comments
 (0)