Skip to content

Add support of EXPLAIN QUERY PLAN syntax for SQLite dialect #1458

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

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

git-hulk
Copy link
Member

@git-hulk git-hulk commented Oct 5, 2024

This closes #1455 and introduces one keyword: PLAN.

For the syntax documentation, please refer to:

https://sqlite.org/lang_explain.html

@coveralls
Copy link

coveralls commented Oct 5, 2024

Pull Request Test Coverage Report for Build 11227323789

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 21 of 24 (87.5%) changed or added relevant lines in 3 files are covered.
  • 297 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.02%) to 89.326%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/mod.rs 0 1 0.0%
tests/sqlparser_common.rs 18 20 90.0%
Files with Coverage Reduction New Missed Lines %
tests/sqlparser_snowflake.rs 1 98.01%
src/ast/mod.rs 2 82.47%
tests/sqlparser_sqlite.rs 5 98.15%
src/ast/ddl.rs 67 86.74%
src/parser/mod.rs 222 93.37%
Totals Coverage Status
Change from base Build 11186281805: 0.02%
Covered Lines: 30060
Relevant Lines: 33652

💛 - Coveralls

@git-hulk
Copy link
Member Author

git-hulk commented Oct 5, 2024

cc @iffyio

src/ast/mod.rs Outdated
Comment on lines 3317 to 3322
if *query_plan {
write!(f, "QUERY PLAN ")?;
} else {
if *analyze {
write!(f, "ANALYZE ")?;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we skip the else condition if it works just as well to do?

if query_plan {
   write!()
}
if analyze {
  write!()
}

thinking that would keep this part simpler, even though the parser only accepts one or the other for the same statement

Copy link
Member Author

Choose a reason for hiding this comment

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

@iffyio Yes, that makes sense. It's better to keep the fmt simpler.

@git-hulk git-hulk requested a review from iffyio October 8, 2024 02:16
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! cc @alamb

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 @git-hulk and @iffyio

@alamb alamb merged commit 7905fb4 into apache:main Oct 8, 2024
10 checks passed
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.

EXPLAIN QUERY PLAN fails to parse (sqlite)
4 participants