mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 18:57:21 +00:00
feat: add precision for TIME, DATETIME, and TIMESTAMP data types (#701)
Now all those statements are both parsed and displayed with precision and timezone info. Tests were added to the ones presented in the ANSI standard.
This commit is contained in:
parent
cdf4447065
commit
65c5a37bce
5 changed files with 108 additions and 40 deletions
|
@ -2944,7 +2944,7 @@ fn parse_literal_time() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Time(TimezoneInfo::None),
|
||||
data_type: DataType::Time(None, TimezoneInfo::None),
|
||||
value: "01:23:34".into(),
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
|
@ -2957,7 +2957,7 @@ fn parse_literal_datetime() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Datetime,
|
||||
data_type: DataType::Datetime(None),
|
||||
value: "1999-01-01 01:23:34.45".into(),
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
|
@ -2970,7 +2970,7 @@ fn parse_literal_timestamp_without_time_zone() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Timestamp(TimezoneInfo::None),
|
||||
data_type: DataType::Timestamp(None, TimezoneInfo::None),
|
||||
value: "1999-01-01 01:23:34".into(),
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
|
@ -2985,7 +2985,7 @@ fn parse_literal_timestamp_with_time_zone() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Timestamp(TimezoneInfo::Tz),
|
||||
data_type: DataType::Timestamp(None, TimezoneInfo::Tz),
|
||||
value: "1999-01-01 01:23:34Z".into(),
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue