feat: Move create table logic to frontend (#455)

* refactor: dependency, from frontend depends on datanode to datanode depends on frontend

* wip: start frontend in datanode

* wip: migrate create database to frontend

* wip: impl alter table

* fix: CR comments

* feat: add table id and region ids field to CreateExpr

* chore: rebase develop

* refactor: frontend catalog should set from datanode

* feat: gRPC AddColumn request support add multi columns

* wip: move create table and create-on-insertion to frontend

* wip: error handling

* fix: some unit tests

* fix: all unit tests

* chore: merge develop

* feat: add create/alter-on-insertion to dist_insert/sql_dist_insert

* fix: add region number/catalog/schema to InsertExpr

* feat: add handle_create_table/handle_create_database...

* fix: remove catalog from insert expr

* fix: CR comments

* fix: when running in standalone mode, mysql opts and postgres opts should pass to frontend so that auctually running service can change the port to listen on

* refactor: add a standalone subcommand, move frontend start stuff to cmd package

* chore: optimize create table failure logs

* docs: change readme

* docs: update readme
This commit is contained in:
Lei, Huang
2022-11-14 10:54:35 +08:00
committed by GitHub
parent 488eabce4a
commit fae331d2ba
52 changed files with 1356 additions and 721 deletions

View File

@@ -1,4 +1,4 @@
use api::v1::{alter_expr, AlterExpr};
use api::v1::{alter_expr, AddColumn, AlterExpr};
use sqlparser::ast::{ColumnDef, ObjectName, TableConstraint};
use crate::error::UnsupportedAlterTableStatementSnafu;
@@ -51,8 +51,11 @@ impl TryFrom<AlterTable> for AlterExpr {
.fail();
}
AlterTableOperation::AddColumn { column_def } => {
alter_expr::Kind::AddColumn(api::v1::AddColumn {
column_def: Some(sql_column_def_to_grpc_column_def(column_def)?),
alter_expr::Kind::AddColumns(api::v1::AddColumns {
add_columns: vec![AddColumn {
column_def: Some(sql_column_def_to_grpc_column_def(column_def)?),
is_key: false,
}],
})
}
};