-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
97 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ | |
|
||
mod expr; | ||
mod plan; | ||
mod step; | ||
|
||
pub use expr::*; | ||
pub use plan::*; | ||
pub use step::*; |
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::Step; | ||
|
||
/// A plan is a directed, acyclic graph of steps. | ||
/// | ||
/// The plan is represented as an array of steps, with each step referencing | ||
/// it's children (inputs) by index. The array is topologically sorted so that | ||
/// all children have indices less than the step that references them. | ||
#[derive(Debug)] | ||
pub struct Plan { | ||
/// The steps in the plan. | ||
pub steps: Vec<Step>, | ||
} |
1 change: 0 additions & 1 deletion
1
...expr__tests__physical_exprs_yaml.snap.new → ...al__expr__tests__physical_exprs_yaml.snap
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,6 +1,5 @@ | ||
--- | ||
source: crates/sparrow-physical/src/expr.rs | ||
assertion_line: 63 | ||
expression: yaml | ||
--- | ||
- kind: !column foo | ||
|
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,59 @@ | ||
use arrow_schema::SchemaRef; | ||
|
||
#[derive(Debug, serde::Serialize, serde::Deserialize)] | ||
#[repr(transparent)] | ||
#[serde(transparent)] | ||
pub struct StepId(usize); | ||
|
||
/// A single step in the physical plan. | ||
#[derive(Debug, serde::Serialize, serde::Deserialize)] | ||
pub struct Step { | ||
pub id: StepId, | ||
/// The kind of step being performed. | ||
pub kind: StepKind, | ||
/// Steps which act as input (children) of this step. | ||
pub children: Vec<StepId>, | ||
/// The schema for this step. | ||
pub schema: SchemaRef, | ||
} | ||
|
||
/// The kinds of stesp that can occur in the physical plan. | ||
#[derive(Debug, serde::Serialize, serde::Deserialize)] | ||
#[serde(rename_all = "snake_case")] | ||
|
||
pub enum StepKind { | ||
/// Scan the given table. | ||
Scan { | ||
table_name: String, | ||
}, | ||
/// Merge the given relations. | ||
Merge, | ||
/// Apply a projection to adjust columns in the table. | ||
/// | ||
/// The output includes the same rows as the input, but with columns | ||
/// projected as configured. | ||
Project { | ||
/// Expressions to apply to compute additional input columns. | ||
exprs: Vec<crate::Expr>, | ||
/// Indices of expressions to use for the output. | ||
/// | ||
/// The length should be the same as the number of fields in the schema. | ||
outputs: Vec<usize>, | ||
}, | ||
/// Filter the results based on a boolean predicate. | ||
Filter { | ||
/// Expressions to apply to compute the predicate. | ||
/// | ||
/// The last expression should be the boolean predicate. | ||
exprs: Vec<crate::Expr>, | ||
}, | ||
/// A step that repartitions the output. | ||
Repartition { | ||
num_partitions: usize, | ||
/// Expressions to apply to compute columns which may be referenced by `keys`. | ||
exprs: Vec<crate::Expr>, | ||
/// Indices of expression columns representing the keys. | ||
keys: Vec<usize>, | ||
}, | ||
Error, | ||
} |