Skip to content

Conversation

@alexkyllo
Copy link
Contributor

@alexkyllo alexkyllo commented Jan 4, 2020

Microsoft SQL Server does not use LIMIT syntax to limit the query result set. Instead, the syntax is SELECT TOP (numeric expression) [PERCENT] [WITH TIES]
See: https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql

This is for Issue #149

This adds a Top child struct to the Select struct. It may or may not be problematic that Select would now have Top nested in it, while the outer Query struct has a limit field, when TOP and LIMIT have basically the same meaning in different SQL dialects. But since TOP is part of the SELECT clause in MSSQL's grammar, this seemed to be the most straightforward way to achieve support for it. Open to suggestions!

@alexkyllo
Copy link
Contributor Author

alexkyllo commented Jan 4, 2020

I didn't get the clippy::double-must-use error when I ran cargo clippy locally. Trying to reproduce...
Edit: Reproduced, once I updated my rust toolchain. Pushing a commit to remove the redundant #[must_use] attribute

@coveralls
Copy link

Pull Request Test Coverage Report for Build 489

  • 85 of 87 (97.7%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.2%) to 93.122%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ast/query.rs 15 16 93.75%
src/parser.rs 19 20 95.0%
Files with Coverage Reduction New Missed Lines %
src/ast/ddl.rs 1 95.4%
src/test_utils.rs 1 91.04%
Totals Coverage Status
Change from base Build 481: 0.2%
Covered Lines: 4644
Relevant Lines: 4987

💛 - Coveralls

@benesch
Copy link
Contributor

benesch commented Jan 13, 2020

Thanks very much for this! Very appreciated.

@benesch benesch merged commit 172ba42 into apache:master Jan 13, 2020
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.

3 participants