mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 10:47:22 +00:00
Change TIMESTAMP
and TIME
parsing so that time zone information is preserved (#641)
* 640 Fixing time zone printing format for TIMESTAMP and TIME * 640 Removing unnecessary changes * Update src/ast/data_type.rs Fix comment typo Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
3beecc0a7a
commit
95464ec72c
6 changed files with 141 additions and 41 deletions
|
@ -2933,7 +2933,7 @@ fn parse_literal_time() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Time,
|
||||
data_type: DataType::Time(TimezoneInfo::None),
|
||||
value: "01:23:34".into()
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
|
@ -2959,16 +2959,13 @@ fn parse_literal_timestamp_without_time_zone() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::Timestamp,
|
||||
data_type: DataType::Timestamp(TimezoneInfo::None),
|
||||
value: "1999-01-01 01:23:34".into()
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
);
|
||||
|
||||
one_statement_parses_to(
|
||||
"SELECT TIMESTAMP WITHOUT TIME ZONE '1999-01-01 01:23:34'",
|
||||
sql,
|
||||
);
|
||||
one_statement_parses_to("SELECT TIMESTAMP '1999-01-01 01:23:34'", sql);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2977,16 +2974,13 @@ fn parse_literal_timestamp_with_time_zone() {
|
|||
let select = verified_only_select(sql);
|
||||
assert_eq!(
|
||||
&Expr::TypedString {
|
||||
data_type: DataType::TimestampTz,
|
||||
data_type: DataType::Timestamp(TimezoneInfo::Tz),
|
||||
value: "1999-01-01 01:23:34Z".into()
|
||||
},
|
||||
expr_from_projection(only(&select.projection)),
|
||||
);
|
||||
|
||||
one_statement_parses_to(
|
||||
"SELECT TIMESTAMP WITH TIME ZONE '1999-01-01 01:23:34Z'",
|
||||
sql,
|
||||
);
|
||||
one_statement_parses_to("SELECT TIMESTAMPTZ '1999-01-01 01:23:34Z'", sql);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue