-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve output of plan * Fix print of alias and the output of joins * Allow the test utils of the plan to be used elsewhere * Use the arrow only for nodes, make timing optional * Apply new clippy hints and remove old test logic
- Loading branch information
Showing
13 changed files
with
1,305 additions
and
502 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,4 +1,46 @@ | ||
use crate::dml::MutationPlan; | ||
use crate::plan::ProjectListPlan; | ||
use anyhow::Result; | ||
use spacetimedb_expr::StatementSource; | ||
use std::collections::HashMap; | ||
|
||
pub mod compile; | ||
pub mod dml; | ||
pub mod plan; | ||
pub mod printer; | ||
pub mod rules; | ||
|
||
#[derive(Debug)] | ||
pub enum PlanCtx { | ||
ProjectList(ProjectListPlan), | ||
DML(MutationPlan), | ||
} | ||
|
||
impl PlanCtx { | ||
pub(crate) fn optimize(self) -> Result<PlanCtx> { | ||
Ok(match self { | ||
Self::ProjectList(plan) => Self::ProjectList(plan.optimize()?), | ||
Self::DML(plan) => Self::DML(plan.optimize()?), | ||
}) | ||
} | ||
} | ||
|
||
/// A physical context for the result of a query compilation. | ||
#[derive(Debug)] | ||
pub struct PhysicalCtx<'a> { | ||
pub plan: PlanCtx, | ||
pub sql: &'a str, | ||
// A map from table names to their labels | ||
pub vars: HashMap<String, usize>, | ||
pub source: StatementSource, | ||
pub planning_time: Option<std::time::Duration>, | ||
} | ||
|
||
impl PhysicalCtx<'_> { | ||
pub fn optimize(self) -> Result<Self> { | ||
Ok(Self { | ||
plan: self.plan.optimize()?, | ||
..self | ||
}) | ||
} | ||
} |
Oops, something went wrong.