feat: impl create table sql execution (#168)

* catalog manager allocates table id

* rebase develop

* add some tests

* add some more test

* fix some cr comments

* insert into system catalog

* use slice pattern to simplify code

* add optional dependencies

* add sql-to-request test

* successfully recover

* fix unit tests

* rebase develop

* add some tests

* fix some cr comments

* fix some cr comments

* add a lock to CatalogManager

* feat: add gmt_created and gmt_modified columns to system catalog table
This commit is contained in:
Lei, Huang
2022-08-17 10:53:19 +08:00
committed by GitHub
parent 34133fae5a
commit a1c4921933
28 changed files with 902 additions and 121 deletions
+4 -1
View File
@@ -1 +1,4 @@
pub use sqlparser::ast::{ColumnDef, Expr, Ident, ObjectName, SqlOption, TableConstraint, Value};
pub use sqlparser::ast::{
ColumnDef, ColumnOption, ColumnOptionDef, DataType, Expr, Ident, ObjectName, SqlOption,
TableConstraint, Value,
};
+2 -1
View File
@@ -14,7 +14,7 @@ use crate::statements::statement::Statement;
const ENGINE: &str = "ENGINE";
/// Pasre create [table] statement
/// Parses create [table] statement
impl<'a> ParserContext<'a> {
pub(crate) fn parse_create(&mut self) -> Result<Statement> {
self.parser
@@ -42,6 +42,7 @@ impl<'a> ParserContext<'a> {
engine,
constraints,
options,
table_id: 0, // table id is assigned by catalog manager
}))
}
+1
View File
@@ -7,6 +7,7 @@ pub const TIME_INDEX: &str = "__time_index";
pub struct CreateTable {
/// Create if not exists
pub if_not_exists: bool,
pub table_id: u32,
/// Table name
pub name: ObjectName,
pub columns: Vec<ColumnDef>,