-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
149 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use crate::catalog::SchemaRef; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct CreateIndex { | ||
pub index_name: String, | ||
pub table_name: String, | ||
pub table_schema: SchemaRef, | ||
pub key_attrs: Vec<u32>, | ||
} |
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,8 +1,8 @@ | ||
use crate::catalog::Schema; | ||
use crate::catalog::SchemaRef; | ||
use crate::common::table_ref::TableReference; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct CreateTable { | ||
pub name: TableReference, | ||
pub schema: Schema, | ||
pub schema: SchemaRef, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::expression::Expr; | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Filter { | ||
/// The predicate expression, which must have Boolean type. | ||
pub predicate: Expr, | ||
/// The incoming logical plan | ||
pub input: Arc<LogicalPlanV2>, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::catalog::SchemaRef; | ||
use crate::common::table_ref::TableReference; | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Insert { | ||
pub table: TableReference, | ||
pub schema: SchemaRef, | ||
pub input: Arc<LogicalPlanV2>, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::expression::Expr; | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use crate::planner::table_ref::join::JoinType; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Join { | ||
/// Left input | ||
pub left: Arc<LogicalPlanV2>, | ||
/// Right input | ||
pub right: Arc<LogicalPlanV2>, | ||
pub join_type: JoinType, | ||
pub condition: Option<Expr>, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Limit { | ||
pub limit: Option<usize>, | ||
pub offset: Option<usize>, | ||
pub input: Arc<LogicalPlanV2>, | ||
} |
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,7 +1,35 @@ | ||
use crate::planner::logical_plan_v2::create_table::CreateTable; | ||
|
||
mod create_index; | ||
mod create_table; | ||
mod filter; | ||
mod insert; | ||
mod join; | ||
mod limit; | ||
mod project; | ||
mod sort; | ||
mod table_scan; | ||
mod values; | ||
|
||
pub use create_index::CreateIndex; | ||
pub use create_table::CreateTable; | ||
pub use filter::Filter; | ||
pub use insert::Insert; | ||
pub use join::Join; | ||
pub use limit::Limit; | ||
pub use project::Project; | ||
pub use sort::{OrderByExpr, Sort}; | ||
pub use table_scan::TableScan; | ||
pub use values::Values; | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum LogicalPlanV2 { | ||
CreateTable(CreateTable), | ||
CreateIndex(CreateIndex), | ||
Filter(Filter), | ||
Insert(Insert), | ||
Join(Join), | ||
Limit(Limit), | ||
Project(Project), | ||
TableScan(TableScan), | ||
Sort(Sort), | ||
Values(Values), | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use crate::expression::Expr; | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Project { | ||
pub expressions: Vec<Expr>, | ||
pub input: Arc<LogicalPlanV2>, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::expression::Expr; | ||
use crate::planner::logical_plan_v2::LogicalPlanV2; | ||
use std::sync::Arc; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Sort { | ||
pub expr: Vec<OrderByExpr>, | ||
pub input: Arc<LogicalPlanV2>, | ||
pub limit: Option<usize>, | ||
} | ||
|
||
#[derive(Clone, PartialEq, Eq, Debug)] | ||
pub struct OrderByExpr { | ||
/// The expression to sort on | ||
pub expr: Box<Expr>, | ||
/// The direction of the sort | ||
pub asc: bool, | ||
/// Whether to put Nulls before all other data values | ||
pub nulls_first: bool, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::catalog::ColumnRef; | ||
use crate::common::table_ref::TableReference; | ||
use crate::expression::Expr; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct TableScan { | ||
pub table_name: TableReference, | ||
pub columns: Vec<ColumnRef>, | ||
// TODO project push down | ||
pub filters: Vec<Expr>, | ||
pub limit: Option<usize>, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use crate::catalog::SchemaRef; | ||
use crate::expression::Expr; | ||
|
||
#[derive(derive_new::new, Debug, Clone)] | ||
pub struct Values { | ||
pub schema: SchemaRef, | ||
pub values: Vec<Vec<Expr>>, | ||
} |
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