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

show query support format #6366

Merged

Conversation

TCeason
Copy link
Collaborator

@TCeason TCeason commented Jun 30, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Actually we have three ideas:

  1. For every should support format cause's query modify the planner but that will modify so many planner code.

  2. In clickhouse handler token the SQL and use nom cut the FORMAT keyword and then get the format value. But it has a bad case like this: select format from default.format format xxx;

  3. In this pr, all of the statement is #statment_body and the format is always at the last of the statement body. So we just need to modify the final rule.

Changelog

  • New Feature

Related Issues

Fixes #6298

@vercel
Copy link

vercel bot commented Jun 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Jun 30, 2022 at 0:32AM (UTC)

@mergify
Copy link
Contributor

mergify bot commented Jun 30, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Jun 30, 2022
@TCeason TCeason requested a review from andylokandy June 30, 2022 12:33
@BohuTANG
Copy link
Member

BohuTANG commented Jun 30, 2022

Need a stateless test for it, to avoid someone breaking it in the future, and we can easy to document it from the test case.

@TCeason
Copy link
Collaborator Author

TCeason commented Jun 30, 2022

Need a stateless test for it, to avoid someone breaking it in the future, and we can easy to document it from the test case.

Yes because the ClickHouse http handler will use old parser to parse the sql. If err it’ll directly return err.

So I only add new parser test.

And now in old parser not support format keyword in show or other query like desc.

Maybe we can set the or to draft. when the planer v2 is enable default add some test?

@BohuTANG BohuTANG requested a review from youngsofun July 1, 2022 01:46
@@ -54,7 +54,7 @@ error:
--> SQL:1:21
|
1 | truncate table a.b.c.d
| ^ expected `PURGE` or `;`
| ^ expected `PURGE`, `FORMAT`, or `;`
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@BohuTANG BohuTANG merged commit 91a580b into databendlabs:main Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: query statement support format substmt
2 participants