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

support restoring SQL text from a AST tree #8532

Closed
zier-one opened this issue Nov 30, 2018 · 4 comments
Closed

support restoring SQL text from a AST tree #8532

zier-one opened this issue Nov 30, 2018 · 4 comments

Comments

@zier-one
Copy link
Contributor

zier-one commented Nov 30, 2018

See: Proposal 中文教程

Our main work is in pingcap/parser/ast.
Most of ast.Nodes are in pingcap/parser/ast(Others are in pingcap/tidb/types).

We regard each ast.Node as a subtask, and we can complete one or several subtasks as a PR.
Considering that some ast.Node depends on another ast.Node, we divide sub-tasks into five stages.

Test

We believe that a Restore() function is correct when the SQL text it outputs can be parsed successfully
and the generated AST is equal to the original AST.

See: RunTest and RunRestoreTest

Some ast.Node can't be restored to a complete SQL text, such as an ast.ExprNode.
To test them, we can construct a complete SQL text.

See: expressions_test.go

There are examples which include complete implementation and test:
parser#71

Sub tasks list:

Stage One:

Stage Two:

Stage Three:

Stage Four:

Stage Five:

@AndrewDi
Copy link
Contributor

AndrewDi commented Dec 3, 2018

Waiting this feature to rewriter view's sql...I think we could use create view func to test this feature later.

@zier-one zier-one changed the title Support to restore SQL text from a AST tree Support to restore SQL text from a AST tree, Stage One Dec 4, 2018
@zier-one zier-one changed the title Support to restore SQL text from a AST tree, Stage One support to restore SQL text from a AST tree Dec 5, 2018
@zier-one zier-one changed the title support to restore SQL text from a AST tree support restoring SQL text from a AST tree Dec 6, 2018
@pingcap pingcap deleted a comment from haplone Dec 18, 2018
@AndrewDi

This comment has been minimized.

@zier-one

This comment has been minimized.

@pingcap pingcap deleted a comment from AndrewDi Jan 12, 2019
@zier-one
Copy link
Contributor Author

Many thanks for your contributions.
All the tasks have been completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants