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

[Tracking] Refactor SQL Parser #1218

Closed
3 of 15 tasks
leiysky opened this issue Jul 28, 2021 · 4 comments
Closed
3 of 15 tasks

[Tracking] Refactor SQL Parser #1218

leiysky opened this issue Jul 28, 2021 · 4 comments
Labels
C-improvement Category: improvement

Comments

@leiysky
Copy link
Member

leiysky commented Jul 28, 2021

Part of #1217

Background

To provide a more generic parser abstraction, we need to do some refactor on the current implementation.

Generally, all of the SQL dialects follow some basic rules, with which we can design our own SQL IR(i.e. datafuse specific AST).

With this IR, we can transform the SQL queries in different dialects into the same representation.

The major idea is provide series of standard AST of Datafuse that can be directly parsed from Datafuse SQL dialect. The elements can be catagorized as:

  • Expressions, represents expression entries in a SQL query including identifier, arithmetic operators and functions etc.
  • Statements, represents SQL clauses, including SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and DDL statements.

Beyond this, we can provide interface like ASTTransformer to transform AST produced by other parsers(e.g. MySQL, ClickHouse, Postgres) into the standard AST.

Update: 2021.8.20

We have introduced a series of standard AST API in #1478 .

The main work during this stage is:

Tasks

High priority:

Low priority:

@leiysky leiysky added the C-improvement Category: improvement label Jul 28, 2021
@leiysky
Copy link
Member Author

leiysky commented Jul 28, 2021

Related to #866

@leiysky leiysky changed the title Refactor SQL Parser Tracking: Refactor SQL Parser Aug 2, 2021
@leiysky
Copy link
Member Author

leiysky commented Aug 18, 2021

I've just filed a PR #1478, which introduces a bunch of Datafuse standard SQL AST and a transformer from sqlparser-rs.

Welcome to review and comment.

@leiysky
Copy link
Member Author

leiysky commented Jan 31, 2022

The tokenizer has been introduced in #4024

@leiysky
Copy link
Member Author

leiysky commented May 13, 2022

Closed by #4983

@leiysky leiysky closed this as completed May 13, 2022
SQL engine refactor automation moved this from In progress to Done May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-improvement Category: improvement
Projects
Development

No branches or pull requests

1 participant