Skip to content

[Tracking] Refactor SQL Parser #1218

@leiysky

Description

@leiysky

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions