-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor planner and optimizer to be DRY
- Loading branch information
Showing
4 changed files
with
105 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
use std::rc::Weak; | ||
use std::{cell::RefCell, rc::Rc}; | ||
|
||
use super::emitter::emit_program; | ||
use super::planner::prepare_select_plan; | ||
use crate::storage::sqlite3_ondisk::DatabaseHeader; | ||
use crate::translate::optimizer::optimize_select_plan; | ||
use crate::Connection; | ||
use crate::{schema::Schema, vdbe::Program, Result}; | ||
use sqlite3_parser::ast; | ||
|
||
use super::emitter::emit_program; | ||
use super::optimizer::optimize_plan; | ||
use super::planner::prepare_select_plan; | ||
|
||
pub fn translate_select( | ||
schema: &Schema, | ||
select: ast::Select, | ||
database_header: Rc<RefCell<DatabaseHeader>>, | ||
connection: Weak<Connection>, | ||
) -> Result<Program> { | ||
let select_plan = prepare_select_plan(schema, select)?; | ||
let optimized_plan = optimize_plan(select_plan)?; | ||
let optimized_plan = optimize_select_plan(select_plan)?; | ||
emit_program(database_header, optimized_plan, connection) | ||
} |