Skip to content

Commit c503d75

Browse files
authored
Merge branch 'main' into refactor
2 parents 00a3fb0 + a5832f5 commit c503d75

15 files changed

+36
-23
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.

common/ast/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ common-functions = { path = "../functions" }
1919
# TODO (andylokandy): Use the version from crates.io once
2020
# https://github.com/brendanzab/codespan/pull/331 is released.
2121
codespan-reporting = { git = "https://github.com/brendanzab/codespan", rev = "c84116f5" }
22-
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "49f4ec2" }
22+
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "fee0056" }
2323

2424
# Crates.io dependencies
2525
async-trait = "0.1.53"

common/exception/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ tonic = "=0.6.2"
2626

2727
# Github dependencies
2828
bincode = { git = "https://github.com/datafuse-extras/bincode", rev = "fd3f9ff" }
29-
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "49f4ec2" }
29+
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "fee0056" }

common/functions/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ serde_json = "1.0.79"
4444
sha1 = "0.10.1"
4545
sha2 = "0.10.2"
4646
simdutf8 = "0.1.4"
47-
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "49f4ec2" }
47+
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "fee0056" }
4848
strength_reduce = "0.2.3"
4949
twox-hash = "1.6.2"
5050
uuid = { version = "0.8.2", features = ["v4"] }

query/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ common-tracing = { path = "../common/tracing" }
5454
bincode = { git = "https://github.com/datafuse-extras/bincode", rev = "fd3f9ff" }
5555
opensrv-clickhouse = { git = "https://github.com/datafuselabs/opensrv", rev = "9690be9", package = "opensrv-clickhouse" }
5656
opensrv-mysql = { git = "https://github.com/datafuselabs/opensrv", rev = "967477f1", package = "opensrv-mysql" }
57-
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "49f4ec2" }
57+
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "fee0056" }
5858

5959
# Crates.io dependencies
6060
ahash = "0.7.6"

query/src/sql/sql_common.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,26 @@ impl SQLCommon {
4141
SQLDataType::Real | SQLDataType::Double => Ok(f64::to_data_type()),
4242
SQLDataType::Boolean => Ok(bool::to_data_type()),
4343
SQLDataType::Date => Ok(DateType::arc()),
44-
SQLDataType::Timestamp | SQLDataType::DateTime(None) => Ok(DateTimeType::arc(0, None)),
44+
// default precision is 6, microseconds
45+
SQLDataType::Timestamp(None) | SQLDataType::DateTime(None) => {
46+
Ok(DateTimeType::arc(6, None))
47+
}
48+
SQLDataType::Timestamp(Some(precision)) => {
49+
if *precision <= 9 {
50+
Ok(DateTimeType::arc(*precision as usize, None))
51+
} else {
52+
Err(ErrorCode::IllegalDataType(format!(
53+
"The SQL data type TIMESTAMP(n), n only ranges from 0~9, {} is invalid",
54+
precision
55+
)))
56+
}
57+
}
4558
SQLDataType::DateTime(Some(precision)) => {
4659
if *precision <= 9 {
4760
Ok(DateTimeType::arc(*precision as usize, None))
4861
} else {
4962
Err(ErrorCode::IllegalDataType(format!(
50-
"The SQL data type DateTime(n), n only ranges from 0~9, {} is invalid",
63+
"The SQL data type DATETIME(n), n only ranges from 0~9, {} is invalid",
5164
precision
5265
)))
5366
}

tests/suites/0_stateless/02_function/02_0002_function_cast.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ SELECT parse_json('"test"')::float32; -- {ErrorCode 1010}
8989
SELECT parse_json('"test"')::float64; -- {ErrorCode 1010}
9090
SELECT parse_json('null')::float64; -- {ErrorCode 1010}
9191
SELECT parse_json('"2022-01-01"')::date;
92-
SELECT parse_json('"2022-01-01 01:01:01"')::datetime;
92+
SELECT parse_json('"2022-01-01 01:01:01"')::datetime(0);
9393
SELECT parse_json('"test"')::date; -- {ErrorCode 1010}
9494
SELECT parse_json('"test"')::datetime; -- {ErrorCode 1010}
9595
SELECT parse_json('null')::datetime; -- {ErrorCode 1010}

tests/suites/0_stateless/02_function/02_0011_function_window_funnel.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
drop table if exists funnel_test;
22

3-
create table funnel_test (timestamp UInt32, d Date, dt DateTime, event UInt32) engine=Memory;
3+
create table funnel_test (timestamp UInt32, d Date, dt DateTime(0), event UInt32) engine=Memory;
44
insert into funnel_test values
55
(0, '2021-01-01', '2021-01-01 00:00:00', 1000),
66
(1, '2021-01-02', '2021-01-01 00:00:01', 1001),

tests/suites/0_stateless/02_function/02_0012_function_datetimes.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,5 @@
162162
1
163163
===INSERT===
164164
1
165-
2022-04-02 15:10:28 2022-04-02 15:10:28.000
166-
2022-04-02 15:10:28 2022-04-02 15:10:28.221
165+
2022-04-02 15:10:28.000000 2022-04-02 15:10:28.000
166+
2022-04-02 15:10:28.221000 2022-04-02 15:10:28.221

tests/suites/0_stateless/03_dml/03_0003_select_group_by.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ NULL 2 3
3636
==GROUP BY DATETIMES==
3737
2022-04-01 5
3838
2022-04-02 5
39-
2022-04-01 00:00:00 5
40-
2022-04-01 00:00:01 5
39+
2022-04-01 00:00:00.000000 5
40+
2022-04-01 00:00:01.000000 5

0 commit comments

Comments
 (0)