-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* simplify executor for 01-03 to 01-05 Signed-off-by: Runji Wang <[email protected]> * 01-03: refine docs Signed-off-by: Runji Wang <[email protected]> Signed-off-by: Runji Wang <[email protected]>
- Loading branch information
1 parent
17bbac1
commit 394cca8
Showing
17 changed files
with
353 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
use super::*; | ||
use crate::binder::BoundCreateTable; | ||
use crate::catalog::TableRefId; | ||
use crate::storage::StorageRef; | ||
|
||
/// The executor of `CREATE TABLE` statement. | ||
pub struct CreateTableExecutor { | ||
pub stmt: BoundCreateTable, | ||
pub catalog: CatalogRef, | ||
pub storage: StorageRef, | ||
} | ||
|
||
impl Executor for CreateTableExecutor { | ||
fn execute(&mut self) -> Result<DataChunk, ExecuteError> { | ||
let schema = self.catalog.get_schema(self.stmt.schema_id).unwrap(); | ||
let table_id = schema.add_table(&self.stmt.table_name).unwrap(); | ||
impl Executor { | ||
pub fn execute_create_table(&self, stmt: BoundCreateTable) -> Result<DataChunk, ExecuteError> { | ||
let schema = self.catalog.get_schema(stmt.schema_id).unwrap(); | ||
let table_id = schema.add_table(&stmt.table_name).unwrap(); | ||
let table = schema.get_table(table_id).unwrap(); | ||
for (name, desc) in &self.stmt.columns { | ||
for (name, desc) in &stmt.columns { | ||
table.add_column(name, desc.clone()).unwrap(); | ||
} | ||
self.storage | ||
.add_table(TableRefId::new(self.stmt.schema_id, table_id))?; | ||
.add_table(TableRefId::new(stmt.schema_id, table_id))?; | ||
Ok(DataChunk::single(1)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
use super::*; | ||
use crate::binder::BoundCreateTable; | ||
use crate::catalog::TableRefId; | ||
use crate::storage::StorageRef; | ||
|
||
/// The executor of `CREATE TABLE` statement. | ||
pub struct CreateTableExecutor { | ||
pub stmt: BoundCreateTable, | ||
pub catalog: CatalogRef, | ||
pub storage: StorageRef, | ||
} | ||
|
||
impl Executor for CreateTableExecutor { | ||
fn execute(&mut self) -> Result<DataChunk, ExecuteError> { | ||
let schema = self.catalog.get_schema(self.stmt.schema_id).unwrap(); | ||
let table_id = schema.add_table(&self.stmt.table_name).unwrap(); | ||
impl Executor { | ||
pub fn execute_create_table(&self, stmt: BoundCreateTable) -> Result<DataChunk, ExecuteError> { | ||
let schema = self.catalog.get_schema(stmt.schema_id).unwrap(); | ||
let table_id = schema.add_table(&stmt.table_name).unwrap(); | ||
let table = schema.get_table(table_id).unwrap(); | ||
for (name, desc) in &self.stmt.columns { | ||
for (name, desc) in &stmt.columns { | ||
table.add_column(name, desc.clone()).unwrap(); | ||
} | ||
self.storage | ||
.add_table(TableRefId::new(self.stmt.schema_id, table_id))?; | ||
.add_table(TableRefId::new(stmt.schema_id, table_id))?; | ||
Ok(DataChunk::single(1)) | ||
} | ||
} |
Oops, something went wrong.