Skip to content

Commit 48de45e

Browse files
authored
Merge branch 'main' into modify_docs
2 parents 1d043f2 + 45fe702 commit 48de45e

File tree

68 files changed

+1126
-439
lines changed

Some content is hidden

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

68 files changed

+1126
-439
lines changed

Cargo.lock

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

docs/doc/30-reference/30-sql/00-ddl/40-stage/01-ddl-create-stage.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CREATE STAGE [ IF NOT EXISTS ] <internal_stage_name>
1212
[ FILE_FORMAT = ( { TYPE = { CSV | PARQUET } [ formatTypeOptions ] ) } ]
1313
[ COPY_OPTIONS = ( copyOptions ) ]
1414
[ COMMENT = '<string_literal>' ]
15-
15+
1616
-- External stage
1717
CREATE STAGE [ IF NOT EXISTS ] <external_stage_name>
1818
externalStageParams
@@ -70,8 +70,8 @@ externalStageParams ::=
7070
### formatTypeOptions
7171
```
7272
formatTypeOptions ::=
73-
RECORD_DELIMITER = '<character>'
74-
FIELD_DELIMITER = '<character>'
73+
RECORD_DELIMITER = '<character>'
74+
FIELD_DELIMITER = '<character>'
7575
SKIP_HEADER = <integer>
7676
```
7777

@@ -85,11 +85,13 @@ formatTypeOptions ::=
8585
```
8686
copyOptions ::=
8787
[ SIZE_LIMIT = <num> ]
88+
[ PURGE = <bool> ]
8889
```
8990

9091
| Parameters | Description | Required |
9192
| ----------- | ----------- | --- |
9293
| `SIZE_LIMIT = <num>` | Number (> 0) that specifies the maximum rows of data to be loaded for a given COPY statement. Default `0` | Optional |
94+
| `PURGE = <bool>` | True specifies that the command will purge the files in the stage if they are loaded successfully into table. Default `false` | Optional |
9395

9496

9597
## Examples

docs/doc/30-reference/30-sql/10-dml/dml-copy-into-location.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ externalLocation (for Amazon S3) ::=
5656
### formatTypeOptions
5757
```
5858
formatTypeOptions ::=
59-
RECORD_DELIMITER = '<character>'
60-
FIELD_DELIMITER = '<character>'
59+
RECORD_DELIMITER = '<character>'
60+
FIELD_DELIMITER = '<character>'
6161
SKIP_HEADER = <integer>
6262
```
6363

docs/doc/30-reference/30-sql/10-dml/dml-copy-into-table.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ A regular expression pattern string, enclosed in single quotes, specifying the f
9797

9898
```
9999
formatTypeOptions ::=
100-
RECORD_DELIMITER = '<character>'
101-
FIELD_DELIMITER = '<character>'
100+
RECORD_DELIMITER = '<character>'
101+
FIELD_DELIMITER = '<character>'
102102
SKIP_HEADER = <integer>
103103
COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE
104104
```
@@ -129,7 +129,7 @@ Default: `NONE`
129129

130130
Values:
131131

132-
| Values | Notes |
132+
| Values | Notes |
133133
|---------------|-----------------------------------------------------------------|
134134
| `AUTO` | Auto detect compression via file extensions |
135135
| `GZIP` | |
@@ -145,11 +145,13 @@ Values:
145145
```
146146
copyOptions ::=
147147
[ SIZE_LIMIT = <num> ]
148+
[ PURGE = <bool> ]
148149
```
149150

150151
| Parameters | Description | Required |
151152
| ----------- | ----------- | --- |
152153
| `SIZE_LIMIT = <num>` | Number (> 0) that specifies the maximum rows of data to be loaded for a given COPY statement. Default `0` | Optional |
154+
| `PURGE = <bool>` | True that specifies the command will purge the files in the stage if they are loaded successfully into table. Default `false` | Optional |
153155

154156
## Examples
155157

docs/doc/30-reference/30-sql/70-system-tables/system-query-log.md

Lines changed: 100 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,71 @@
22
title: system.query_log
33
---
44

5-
A read-only in-memory table stores all the query logs;
5+
A read-only in-memory table stores all the query logs.
66

7-
```sql
8-
SELECT * FROM system.query_log ORDER BY event_time DESC LIMIT 1\G
9-
*************************** 1. row ***************************
7+
8+
## Columns
9+
10+
```
11+
CREATE TABLE `query_log` (
12+
`log_type` TINYINT,
13+
`handler_type` VARCHAR,
14+
`tenant_id` VARCHAR,
15+
`cluster_id` VARCHAR,
16+
`sql_user` VARCHAR,
17+
`sql_user_quota` VARCHAR,
18+
`sql_user_privileges` VARCHAR,
19+
`query_id` VARCHAR,
20+
`query_kind` VARCHAR,
21+
`query_text` VARCHAR,
22+
`event_date` DATE,
23+
`event_time` TIMESTAMP(3),
24+
`current_database` VARCHAR,
25+
`databases` VARCHAR,
26+
`tables` VARCHAR,
27+
`columns` VARCHAR,
28+
`projections` VARCHAR,
29+
`written_rows` BIGINT UNSIGNED,
30+
`written_bytes` BIGINT UNSIGNED,
31+
`written_io_bytes` BIGINT UNSIGNED,
32+
`written_io_bytes_cost_ms` BIGINT UNSIGNED,
33+
`scan_rows` BIGINT UNSIGNED,
34+
`scan_bytes` BIGINT UNSIGNED,
35+
`scan_io_bytes` BIGINT UNSIGNED,
36+
`scan_io_bytes_cost_ms` BIGINT UNSIGNED,
37+
`scan_partitions` BIGINT UNSIGNED,
38+
`total_partitions` BIGINT UNSIGNED,
39+
`result_rows` BIGINT UNSIGNED,
40+
`result_bytes` BIGINT UNSIGNED,
41+
`cpu_usage` INT UNSIGNED,
42+
`memory_usage` BIGINT UNSIGNED,
43+
`client_info` VARCHAR,
44+
`client_address` VARCHAR,
45+
`exception_code` INT,
46+
`exception_text` VARCHAR,
47+
`stack_trace` VARCHAR,
48+
`server_version` VARCHAR,
49+
`session_settings` VARCHAR,
50+
`extra` VARCHAR
51+
)
52+
```
53+
54+
## Examples
55+
56+
```
57+
*************************** 4. row ***************************
1058
log_type: 1
1159
handler_type: MySQL
12-
tenant_id: test_tenant
13-
cluster_id: test_cluster
60+
tenant_id: admin
61+
cluster_id:
1462
sql_user: root
1563
sql_user_quota: UserQuota<cpu:0,mem:0,store:0>
16-
sql_user_privileges: GRANT ALL ON *.* TO 'root'@'127.0.0.1', ROLES: []
17-
query_id: da879c17-94bb-4163-b2ac-ff4786bbe69e
18-
query_kind: SelectPlan
19-
query_text: SELECT * from system.query_log order by event_time desc limit 1
20-
event_date: 2022-03-24
21-
event_time: 2022-03-24 11:13:27.414
64+
sql_user_privileges: GRANT ALL ON *.*, ROLES: []
65+
query_id: eda2a82b-3667-4ffb-b436-953785178c39
66+
query_kind: Query
67+
query_text: select avg(number) from numbers(1000000)
68+
event_date: 2022-09-08
69+
event_time: 2022-09-08 03:32:39.517
2270
current_database: default
2371
databases:
2472
tables:
@@ -34,16 +82,50 @@ written_io_bytes_cost_ms: 0
3482
scan_io_bytes_cost_ms: 0
3583
scan_partitions: 0
3684
total_partitions: 0
37-
result_rows: 0
38-
result_bytes: 0
39-
cpu_usage: 10
40-
memory_usage: 1603
85+
86+
, skip_header=0, sql_dialect=PostgreSQL, storage_read_buffer_size=1048576, timezone=UTC, unquoted_ident_case_sensitive=0, wait_for_async_insert=1, wait_for_async_insert_timeout=100, scope: SESSION
87+
extra:
88+
89+
90+
*************************** 5. row ***************************
91+
log_type: 2
92+
handler_type: MySQL
93+
tenant_id: admin
94+
cluster_id:
95+
sql_user: root
96+
sql_user_quota: UserQuota<cpu:0,mem:0,store:0>
97+
sql_user_privileges: GRANT ALL ON *.*, ROLES: []
98+
query_id: eda2a82b-3667-4ffb-b436-953785178c39
99+
query_kind: Query
100+
query_text: select avg(number) from numbers(1000000)
101+
event_date: 2022-09-08
102+
event_time: 2022-09-08 03:32:39.519
103+
current_database: default
104+
databases:
105+
tables:
106+
columns:
107+
projections:
108+
written_rows: 0
109+
written_bytes: 0
110+
written_io_bytes: 0
111+
written_io_bytes_cost_ms: 0
112+
scan_rows: 1000000
113+
scan_bytes: 8000000
114+
scan_io_bytes: 0
115+
scan_io_bytes_cost_ms: 0
116+
scan_partitions: 0
117+
total_partitions: 0
118+
result_rows: 1
119+
result_bytes: 9
120+
cpu_usage: 24
121+
memory_usage: 0
41122
client_info:
42-
client_address: 127.0.0.1:56744
123+
client_address: 127.0.0.1:53304
43124
exception_code: 0
44125
exception_text:
45126
stack_trace:
46127
server_version:
47-
session_settings: enable_new_processor_framework=1, flight_client_timeout=60, max_block_size=10000, max_threads=8, storage_occ_backoff_init_delay_ms=5, storage_occ_backoff_max_delay_ms=20000, storage_occ_backoff_max_elapsed_ms=120000, storage_read_buffer_size=1048576, scope: SESSION
128+
session_settings: compression=None, empty_as_default=1, enable_async_insert=0, enable_new_processor_framework=1, enable_planner_v2=1, field_delimiter=,, flight_client_timeout=60, group_by_two_level_threshold=10000, max_block_size=10000, max_execute_time=0, max_threads=24, quoted_ident_case_sensitive=1, record_delimiter=
129+
, skip_header=0, sql_dialect=PostgreSQL, storage_read_buffer_size=1048576, timezone=UTC, unquoted_ident_case_sensitive=0, wait_for_async_insert=1, wait_for_async_insert_timeout=100, scope: SESSION
48130
extra:
49131
```

src/common/io/src/buffer/buffer_read_datetime_ext.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,27 @@ where R: BufferRead
9797
loop {
9898
buf.clear();
9999
let size = self.keep_read(&mut buf, |f| (b'0'..=b'9').contains(&f))?;
100-
match get_time(&mut buf, size) {
101-
Ok(time) => times.push(time),
102-
Err(e) => return Err(e),
103-
}
104-
if times.len() == 3 {
100+
if size == 0 {
105101
break;
102+
} else {
103+
let time = get_time(&mut buf, size)?;
104+
times.push(time);
105+
if times.len() == 3 {
106+
break;
107+
}
108+
self.ignore_byte(b':')?;
106109
}
107-
self.must_ignore_byte(b':')?;
108110
}
111+
// Time part is HH:MM or HH or empty
112+
// Examples: '2022-02-02T', '2022-02-02 ', '2022-02-02T02', '2022-02-02T3:', '2022-02-03T03:13', '2022-02-03T03:13:'
113+
if times.len() < 3 {
114+
times.resize(3, 0);
115+
dt = tz
116+
.from_local_datetime(&d.and_hms(times[0], times[1], times[2]))
117+
.unwrap();
118+
return less_1000(dt);
119+
}
120+
109121
dt = tz
110122
.from_local_datetime(&d.and_hms(times[0], times[1], times[2]))
111123
.unwrap();

src/common/io/tests/it/buffer/buffer_read_datetime_ext.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ use common_io::prelude::*;
1919
#[test]
2020
fn test_read_datetime_ext() -> Result<()> {
2121
let mut reader = BufferReader::new(
22-
"2023-03-03,2022-02-02,2009-01-01 3:2:1.123,2009-01-01 0:00:00,2009-01-01 00:00:00.123,2009-01-01 00:00:00.123456,0002-03-03T00:01:02,2022-03-04T00:01:02+08:00,2022-03-04T00:01:02-08:00,0000-00-00,0000-00-00 00:00:00,0001-01-01 00:00:00,2020-01-01T11:11:11Z,2009-01-03 00:00:00,2020-01-01T11:11:11.123Z,2055-02-03 10:00:20.234+08:00,2055-02-03 10:00:20.234-08:00,1022-05-16T03:25:02.000000+08:00".as_bytes(),
22+
"2022-02-02T,2022-02-02 12,2022-02-02T13:4:,2022-02-02 12:03,2023-03-03,2022-02-02,2009-01-01 3:2:1.123,2009-01-01 0:00:00,2009-01-01 00:00:00.123,2009-01-01 00:00:00.123456,0002-03-03T00:01:02,2022-03-04T00:01:02+08:00,2022-03-04T00:01:02-08:00,0000-00-00,0000-00-00 00:00:00,0001-01-01 00:00:00,2020-01-01T11:11:11Z,2009-01-03 00:00:00,2020-01-01T11:11:11.123Z,2055-02-03 10:00:20.234+08:00,2055-02-03 10:00:20.234-08:00,1022-05-16T03:25:02.000000+08:00".as_bytes(),
2323
);
2424
let tz = Tz::UTC;
2525
let expected = vec![
26+
"2022-02-02T00:00:00UTC",
27+
"2022-02-02T12:00:00UTC",
28+
"2022-02-02T13:04:00UTC",
29+
"2022-02-02T12:03:00UTC",
2630
"2023-03-03T00:00:00UTC",
2731
"2022-02-02T00:00:00UTC",
2832
"2009-01-01T03:02:01.123UTC",

src/meta/api/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ common-proto-conv = { path = "../proto-conv" }
2222
common-protos = { path = "../protos" }
2323
common-tracing = { path = "../../common/tracing" }
2424

25-
anyerror = "=0.1.6"
2625
anyhow = "1.0.58"
2726
async-trait = "0.1.56"
2827
enumflags2 = { version = "0.7.5", features = ["serde"] }

0 commit comments

Comments
 (0)