Skip to content

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
Contributor

@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 apache: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