Closed Samyak2 closed 2 years ago
This includes:
sqlparser
to generate AST from SQL code. This part is simple.CREATE DATABASE
and CREATE SCHEMA
sqlparser
's Value
to our Value
.sqlparser
's Expr
to our Expr
.CREATE TABLE
: Columns with name and types only and with IF NOT EXISTS
.INSERT
: into table, simple values.SELECT
: from a table, filter using WHERE
.UPDATE
: a table with simple expr.DELETE
: a table with simple expr.DROP TABLE
, DROP SCHEMA
, DROP DATABASE
Actually, can we reuse sqlparser's Expr (we simply re-export them) ? May be we should also use sqlparser's Value internally, or at least make them inter-convertable?
Would that save us some time & effort?
Actually, can we reuse sqlparser's Expr (we simply re-export them) ? May be we should also use sqlparser's Value internally, or at least make them inter-convertable?
Would that save us some time & effort?
sqlparser::ast::Value
may be good for representation of values in a query, but I don't think it's appropriate for the executor. As an example, the only number variant is stored as a string. So everytime we need to read or do operations on them, we'll need to convert it to an appropriate numeric type. While converting to our own Value
, I have handled this, so that we do not have to bother about this in the executor.
As for Expr
, some of its variants store a Value
. To make it consistent, we should make our own Expr
that stores our Value
. I believe this won't add too much maintenance overhead because extending it will be simply adding a new variant and changing impl TryFrom<sqlparser::ast::Expr>
to use it. It also very clearly describes all the operations that we will support.
Okay cool. Thank you for the explanation. I am looking forward to some unit tests!
Tracking issue for parser integration
Links