feat: switch to using drop table procedure (#1901)

* feat: switch to using drop table procedure

* chore: remove unused attributes

* feat: register the drop table procedure loader

* fix: fix typo
This commit is contained in:
Weny Xu
2023-07-12 11:35:23 +09:00
committed by GitHub
parent 264c5ea720
commit a751aa5ba0
7 changed files with 77 additions and 55 deletions

View File

@@ -44,6 +44,20 @@ impl DdlTask {
) -> Self {
DdlTask::CreateTable(CreateTableTask::new(expr, partitions, table_info))
}
pub fn new_drop_table(
catalog: String,
schema: String,
table: String,
table_id: TableId,
) -> Self {
DdlTask::DropTable(DropTableTask {
catalog,
schema,
table,
table_id,
})
}
}
impl TryFrom<Task> for DdlTask {
@@ -92,19 +106,17 @@ impl TryFrom<SubmitDdlTaskRequest> for PbSubmitDdlTaskRequest {
pub struct SubmitDdlTaskResponse {
pub key: Vec<u8>,
pub table_id: TableId,
pub table_id: Option<TableId>,
}
impl TryFrom<PbSubmitDdlTaskResponse> for SubmitDdlTaskResponse {
type Error = error::Error;
fn try_from(resp: PbSubmitDdlTaskResponse) -> Result<Self> {
let table_id = resp.table_id.context(error::InvalidProtoMsgSnafu {
err_msg: "expected table_id",
})?;
let table_id = resp.table_id.map(|t| t.id);
Ok(Self {
key: resp.key,
table_id: table_id.id,
table_id,
})
}
}