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 keyword NANOSECOND #749

Merged
merged 1 commit into from Dec 6, 2022
Merged

add keyword NANOSECOND #749

merged 1 commit into from Dec 6, 2022

Conversation

waitingkuo
Copy link
Contributor

close #748

let ast = Parser::parse_sql(&dialect, "SELECT EXTRACT(NANOSECOND FROM NOW());").unwrap();
println!("AST: {:?}", ast);

AST: [Query(Query { with: None, body: Select(Select { distinct: false, top: None, projection: [UnnamedExpr(Extract { field: Nanosecond, expr: Function(Function { name: ObjectName([Ident { value: "NOW", quote_style: None }]), args: [], over: None, distinct: false, special: false }) })], into: None, from: [], lateral_views: [], selection: None, group_by: [], cluster_by: [], distribute_by: [], sort_by: [], having: None, qualify: None }), order_by: [], limit: None, offset: None, fetch: None, lock: None })]

@waitingkuo waitingkuo marked this pull request as ready for review December 6, 2022 10:06
Comment on lines +364 to +365
NANOSECOND,
NANOSECONDS,
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 new keywords (follows the ascending order)

Comment on lines +94 to +95
Nanosecond,
Nanoseconds,
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 new DateTimeFields

Comment on lines +1743 to +1745
verified_stmt("SELECT EXTRACT(MILLISECOND FROM d)");
verified_stmt("SELECT EXTRACT(MICROSECOND FROM d)");
verified_stmt("SELECT EXTRACT(NANOSECOND FROM d)");
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 test cases

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3628501076

  • 2 of 6 (33.33%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 86.287%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/value.rs 1 2 50.0%
src/parser.rs 1 4 25.0%
Totals Coverage Status
Change from base Build 3623452535: -0.02%
Covered Lines: 12534
Relevant Lines: 14526

💛 - Coveralls

Copy link
Collaborator

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @waitingkuo

@alamb alamb merged commit bda8268 into sqlparser-rs:main Dec 6, 2022
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.

support keyword NANOSECOND
3 participants