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

sqlparser/logictest: add datadriven testing #211

Merged
merged 2 commits into from
Sep 26, 2022
Merged

Conversation

asubiotto
Copy link
Member

This PR adds datadriven testing to FrostDB, which is the ability to write text files with simple commands to create tables, insert data, query data, and specify expected results. To support expressive querying of data, this PR also adds experimental SQL support to FrostDB. This is done by leveraging TiDB's standalone MySQL parser and converting the resulting AST to a FrostDB query.

This commit adds a sqlparse package with the initial functionality to parse
SQL into FrostDB logical plans. Distinct, Aggregate and Filters are all
supported. SQL is parsed using TiDB's standalone MySQL parser. Given the
simplicity of the SQL we support, there are no variant-specific corners we're
painting ourselves into yet.
This commit adds a simple datadriven logic testing framework with the ability
to create tables, insert data, and query data. Some existing distinct and
aggregation tests have been copied and modified to use the new testing
framework.

The advantage of a framework like this is that it makes tests easier to
understand and write, simplifying bug resolution and lowering the bar to
writing tests.
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

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

Veeeeery nice! lgtm!

Did you want to take this to the point where we can remove all the existing tests of this kind, or take it piece by piece?

@asubiotto
Copy link
Member Author

TFTR! Definitely take it piece by piece. This is more of a POC that copies some tests. Hopefully new tests will use this and we'll port existing tests over little by little (maybe on Friday).

@asubiotto asubiotto merged commit ca66a65 into main Sep 26, 2022
@asubiotto asubiotto deleted the alfonso-datadriven branch September 26, 2022 15:02
@asubiotto asubiotto mentioned this pull request Oct 7, 2022
2 tasks
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.

2 participants