Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add with/without time zone #589

Merged
merged 2 commits into from Aug 26, 2022
Merged

Conversation

waitingkuo
Copy link
Contributor

@waitingkuo waitingkuo commented Aug 23, 2022

close #588
close #464

add datetype TimestampTz

add following into parser

TIMESTAMP [WITHOUT TIME ZONE] => Timestamp
TIMESTAMP WITH TIME ZONE and TIMESTAMPTZ => `TimestampTz

Comment on lines 161 to +162
DataType::Timestamp => write!(f, "TIMESTAMP"),
DataType::TimestampTz => write!(f, "TIMESTAMPTZ"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add DataType::TimestampTz

Comment on lines -3123 to 3131
if self.parse_keyword(Keyword::WITH) || self.parse_keyword(Keyword::WITHOUT) {
if self.parse_keyword(Keyword::WITH) {
self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?;
Ok(DataType::TimestampTz)
} else if self.parse_keyword(Keyword::WITHOUT) {
self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?;
Ok(DataType::Timestamp)
} else {
Ok(DataType::Timestamp)
}
Ok(DataType::Timestamp)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable with time zone and without time zone

}
Keyword::TIMESTAMPTZ => Ok(DataType::TimestampTz),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add TimestampTz into parser

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2910912498

  • 17 of 17 (100.0%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 85.485%

Files with Coverage Reduction New Missed Lines %
src/ast/data_type.rs 1 84.72%
src/parser.rs 1 83.07%
Totals Coverage Status
Change from base Build 2889184458: 0.02%
Covered Lines: 9623
Relevant Lines: 11257

💛 - Coveralls

@waitingkuo
Copy link
Contributor Author

@liukun4515 @alamb this is to add time zone support for sql parser

we need this to solve time-zone related issue in apache/datafusion#3148

@liukun4515
Copy link

I need some time to get familiar with the context in the datafusion/arrow-rs. @waitingkuo Maybe be slower to reply

@waitingkuo waitingkuo changed the title add time zone support add with/without time zone Aug 24, 2022
Copy link
Collaborator

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @waitingkuo

@AugustoFKL
Copy link
Contributor

@waitingkuo @andygrove TIMESTAMPTZ and TIMESTAMP WITH TIME ZONE aren't the same. Did a fix PR: #641

ovr pushed a commit to cube-js/sqlparser-rs that referenced this pull request Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Time Zone support Not possible to have timezone in postgres
5 participants