Skip to content

Commit f104282

Browse files
authored
Merge branch 'main' into bump
2 parents 2906c04 + 7ef94fd commit f104282

File tree

83 files changed

+3868
-464
lines changed

Some content is hidden

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

83 files changed

+3868
-464
lines changed

Cargo.lock

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
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",

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
title: FUSE_BLOCK
33
---
44

5-
Returns the block information of a snapshot of table.
5+
Returns the block information for the latest or a specifed snapshot of a table.
6+
7+
The command returns the location information of each parquet file related to a snapshot. This enables downstream applications to access and consume the data stored in the files.
68

79
## Syntax
810

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

+5-5
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

+36-28
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+
```

src/common/jsonb/src/value.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

1515
use std::borrow::Cow;
1616
use std::collections::BTreeMap;
17+
use std::fmt;
1718
use std::fmt::Debug;
1819
use std::fmt::Display;
1920
use std::fmt::Formatter;
20-
use std::fmt::{self};
21-
use std::io::Write;
2221
use std::ops::Neg;
2322

2423
use decimal_rs::Decimal;
@@ -214,11 +213,9 @@ impl<'a> Value<'a> {
214213
}
215214

216215
/// Attempts to serialize the JSONB Value into a byte stream.
217-
pub fn to_writer<W: Write>(&self, mut writer: W) -> Result<(), Error> {
218-
let mut buf = Vec::new();
219-
let mut encoder = Encoder::new(&mut buf);
216+
pub fn to_vec(&self, buf: &mut Vec<u8>) -> Result<(), Error> {
217+
let mut encoder = Encoder::new(buf);
220218
encoder.encode(self)?;
221-
writer.write_all(&buf)?;
222219
Ok(())
223220
}
224221
}

src/common/jsonb/tests/it/parser.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn test_parse_null() {
2424
assert_eq!(value.as_null(), Some(()));
2525

2626
let mut buf: Vec<u8> = Vec::new();
27-
value.to_writer(&mut buf).unwrap();
27+
value.to_vec(&mut buf).unwrap();
2828
assert_eq!(buf, b"\x20\0\0\0\0\0\0\0");
2929
}
3030

@@ -35,7 +35,7 @@ fn test_parse_boolean() {
3535
assert_eq!(value.as_bool(), Some(true));
3636

3737
let mut buf: Vec<u8> = Vec::new();
38-
value.to_writer(&mut buf).unwrap();
38+
value.to_vec(&mut buf).unwrap();
3939
assert_eq!(buf, b"\x20\0\0\0\x40\0\0\0");
4040

4141
let s = r#"false"#;
@@ -44,7 +44,7 @@ fn test_parse_boolean() {
4444
assert_eq!(value.as_bool(), Some(false));
4545

4646
let mut buf: Vec<u8> = Vec::new();
47-
value.to_writer(&mut buf).unwrap();
47+
value.to_vec(&mut buf).unwrap();
4848
assert_eq!(buf, b"\x20\0\0\0\x30\0\0\0");
4949
}
5050

@@ -56,7 +56,7 @@ fn test_parse_number_int64() {
5656
assert_eq!(value.as_i64(), Some(-1234));
5757

5858
let mut buf: Vec<u8> = Vec::new();
59-
value.to_writer(&mut buf).unwrap();
59+
value.to_vec(&mut buf).unwrap();
6060
assert_eq!(buf, b"\x20\0\0\0\x20\0\0\x04\x03\0\xd2\x04");
6161

6262
let s = r#"34567890"#;
@@ -65,7 +65,7 @@ fn test_parse_number_int64() {
6565
assert_eq!(value.as_i64(), Some(34567890));
6666

6767
let mut buf: Vec<u8> = Vec::new();
68-
value.to_writer(&mut buf).unwrap();
68+
value.to_vec(&mut buf).unwrap();
6969
assert_eq!(buf, b"\x20\0\0\0\x20\0\0\x06\x02\0\xd2\x76\x0f\x02");
7070
}
7171

@@ -77,7 +77,7 @@ fn test_parse_number_float64() {
7777
assert_eq!(value.as_f64(), Some(0.0123));
7878

7979
let mut buf: Vec<u8> = Vec::new();
80-
value.to_writer(&mut buf).unwrap();
80+
value.to_vec(&mut buf).unwrap();
8181
assert_eq!(buf, b"\x20\0\0\0\x20\0\0\x03\x02\x04\x7b");
8282

8383
let s = r#"12.34e5"#;
@@ -86,7 +86,7 @@ fn test_parse_number_float64() {
8686
assert_eq!(value.as_f64(), Some(1234000.0));
8787

8888
let mut buf: Vec<u8> = Vec::new();
89-
value.to_writer(&mut buf).unwrap();
89+
value.to_vec(&mut buf).unwrap();
9090
assert_eq!(buf, b"\x20\0\0\0\x20\0\0\x04\0\x03\xd2\x04");
9191
}
9292

@@ -98,7 +98,7 @@ fn test_parse_string() {
9898
assert_eq!(value.as_str(), Some(&Cow::from("asd")));
9999

100100
let mut buf: Vec<u8> = Vec::new();
101-
value.to_writer(&mut buf).unwrap();
101+
value.to_vec(&mut buf).unwrap();
102102
assert_eq!(buf, b"\x20\0\0\0\x10\0\0\x03\x61\x73\x64");
103103

104104
let s = r#""\\\"abc\\\"""#;
@@ -107,7 +107,7 @@ fn test_parse_string() {
107107
assert_eq!(value.as_str(), Some(&Cow::from("\\\"abc\\\"")));
108108

109109
let mut buf: Vec<u8> = Vec::new();
110-
value.to_writer(&mut buf).unwrap();
110+
value.to_vec(&mut buf).unwrap();
111111
assert_eq!(buf, b"\x20\0\0\0\x10\0\0\x07\x5c\x22\x61\x62\x63\x5c\x22");
112112

113113
let s = r#""测试abc""#;
@@ -116,7 +116,7 @@ fn test_parse_string() {
116116
assert_eq!(value.as_str(), Some(&Cow::from("测试abc")));
117117

118118
let mut buf: Vec<u8> = Vec::new();
119-
value.to_writer(&mut buf).unwrap();
119+
value.to_vec(&mut buf).unwrap();
120120
assert_eq!(
121121
buf,
122122
b"\x20\0\0\0\x10\0\0\x09\xe6\xb5\x8b\xe8\xaf\x95\x61\x62\x63"
@@ -128,7 +128,7 @@ fn test_parse_string() {
128128
assert_eq!(value.as_str(), Some(&Cow::from("€")));
129129

130130
let mut buf: Vec<u8> = Vec::new();
131-
value.to_writer(&mut buf).unwrap();
131+
value.to_vec(&mut buf).unwrap();
132132
assert_eq!(buf, b"\x20\0\0\0\x10\0\0\x03\xe2\x82\xac");
133133
}
134134

@@ -139,15 +139,15 @@ fn test_parse_array() {
139139
assert!(value.is_array());
140140

141141
let mut buf: Vec<u8> = Vec::new();
142-
value.to_writer(&mut buf).unwrap();
142+
value.to_vec(&mut buf).unwrap();
143143
assert_eq!(buf, b"\x80\0\0\x06\x40\0\0\0\x20\0\0\x02\x20\0\0\x03\x20\0\0\x05\x10\0\0\x03\x50\0\0\x04\x39\x30\x03\0\xc8\x02\x04\xc2\x12\x0c\x61\x73\x64\x80\0\0\0");
144144

145145
let s = r#"[1,2,3,["a","b","c"]]"#;
146146
let value = parse_value(s.as_bytes()).unwrap();
147147
assert!(value.is_array());
148148

149149
let mut buf: Vec<u8> = Vec::new();
150-
value.to_writer(&mut buf).unwrap();
150+
value.to_vec(&mut buf).unwrap();
151151
assert_eq!(buf, b"\x80\0\0\x04\x20\0\0\x01\x20\0\0\x01\x20\0\0\x01\x50\0\0\x13\x01\x02\x03\x80\0\0\x03\x10\0\0\x01\x10\0\0\x01\x10\0\0\x01\x61\x62\x63");
152152
}
153153

@@ -158,15 +158,15 @@ fn test_parse_object() {
158158
assert!(value.is_object());
159159

160160
let mut buf: Vec<u8> = Vec::new();
161-
value.to_writer(&mut buf).unwrap();
161+
value.to_vec(&mut buf).unwrap();
162162
assert_eq!(buf, b"\x40\0\0\x02\x10\0\0\x02\x10\0\0\x02\x10\0\0\x02\x10\0\0\x02\x6b\x31\x6b\x32\x76\x31\x76\x32");
163163

164164
let s = r#"{"k":"v","a":"b"}"#;
165165
let value = parse_value(s.as_bytes()).unwrap();
166166
assert!(value.is_object());
167167

168168
let mut buf: Vec<u8> = Vec::new();
169-
value.to_writer(&mut buf).unwrap();
169+
value.to_vec(&mut buf).unwrap();
170170
assert_eq!(
171171
buf,
172172
b"\x40\0\0\x02\x10\0\0\x01\x10\0\0\x01\x10\0\0\x01\x10\0\0\x01\x61\x6b\x62\x76"

0 commit comments

Comments
 (0)