mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-24 17:00:37 +00:00
feat: Implement procedure to alter a table for mito engine (#1259)
* feat: wip * fix: Fix CreateMitoTable::table_schema not initialized from json * feat: Implement AlterMitoTable procedure * test: Add test for alter procedure * feat: Register alter procedure * fix: Recover procedures after catalog manager is started * feat: Simplify usage of table schema in create table procedure * test: Add rename test * test: Add drop columns test
This commit is contained in:
@@ -121,6 +121,13 @@ pub trait TableEngineProcedure: Send + Sync {
|
||||
ctx: &EngineContext,
|
||||
request: CreateTableRequest,
|
||||
) -> Result<BoxedProcedure>;
|
||||
|
||||
/// Returns a procedure that alters table by specific `request`.
|
||||
fn alter_table_procedure(
|
||||
&self,
|
||||
ctx: &EngineContext,
|
||||
request: AlterTableRequest,
|
||||
) -> Result<BoxedProcedure>;
|
||||
}
|
||||
|
||||
pub type TableEngineProcedureRef = Arc<dyn TableEngineProcedure>;
|
||||
|
||||
@@ -136,7 +136,7 @@ pub struct OpenTableRequest {
|
||||
}
|
||||
|
||||
/// Alter table request
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AlterTableRequest {
|
||||
pub catalog_name: String,
|
||||
pub schema_name: String,
|
||||
@@ -151,13 +151,13 @@ impl AlterTableRequest {
|
||||
}
|
||||
|
||||
/// Add column request
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AddColumnRequest {
|
||||
pub column_schema: ColumnSchema,
|
||||
pub is_key: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum AlterKind {
|
||||
AddColumns { columns: Vec<AddColumnRequest> },
|
||||
DropColumns { names: Vec<String> },
|
||||
|
||||
Reference in New Issue
Block a user