From e025452443b521c17027aeae320b63904e57279a Mon Sep 17 00:00:00 2001 From: Connor Tsui Date: Sun, 25 Feb 2024 11:48:57 -0500 Subject: [PATCH] add todos --- eggstrain/src/execution/operators/filter.rs | 7 ++++++- eggstrain/src/execution/operators/mod.rs | 9 +++++++++ eggstrain/src/execution/operators/project.rs | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/eggstrain/src/execution/operators/filter.rs b/eggstrain/src/execution/operators/filter.rs index cdda8ac..c091309 100644 --- a/eggstrain/src/execution/operators/filter.rs +++ b/eggstrain/src/execution/operators/filter.rs @@ -10,11 +10,13 @@ use std::sync::Arc; use tokio::sync::broadcast; use tokio::sync::broadcast::error::RecvError; +/// TODO docs pub struct Filter { pub predicate: Arc, pub children: Vec>, } +/// TODO docs impl Filter { pub fn new(predicate: Arc, children: Vec>) -> Self { Self { @@ -23,7 +25,8 @@ impl Filter { } } - /// https://docs.rs/datafusion-physical-plan/36.0.0/src/datafusion_physical_plan/filter.rs.html#307 + /// Taken from DataFusion's `FilterExec` + /// [code](https://docs.rs/datafusion-physical-plan/36.0.0/src/datafusion_physical_plan/filter.rs.html#307) pub fn batch_filter(&self, batch: RecordBatch) -> Result { self.predicate .evaluate(&batch) @@ -36,12 +39,14 @@ impl Filter { } } +/// TODO docs impl Operator for Filter { fn children(&self) -> Vec> { self.children.clone() } } +/// TODO docs #[async_trait] impl UnaryOperator for Filter { type In = RecordBatch; diff --git a/eggstrain/src/execution/operators/mod.rs b/eggstrain/src/execution/operators/mod.rs index e32fd60..603e02b 100644 --- a/eggstrain/src/execution/operators/mod.rs +++ b/eggstrain/src/execution/operators/mod.rs @@ -6,10 +6,16 @@ use tokio::sync::broadcast::{Receiver, Sender}; pub mod filter; pub mod project; +/// Defines shared behavior for all operators +/// +/// TODO docs pub trait Operator { fn children(&self) -> Vec>; } +/// Defines shared behavior for operators with a single logical input +/// +/// TODO docs #[async_trait] pub(crate) trait UnaryOperator: Operator + Send + Sync { type In; @@ -20,6 +26,9 @@ pub(crate) trait UnaryOperator: Operator + Send + Sync { async fn execute(&self, rx: Receiver, tx: Sender); } +/// Defines shared behavior for operators with a two logical inputs (like joins) +/// +/// TODO docs #[async_trait] pub(crate) trait BinaryOperator: Operator + Send + Sync { type InLeft; diff --git a/eggstrain/src/execution/operators/project.rs b/eggstrain/src/execution/operators/project.rs index 55f0c13..79a04f1 100644 --- a/eggstrain/src/execution/operators/project.rs +++ b/eggstrain/src/execution/operators/project.rs @@ -8,6 +8,7 @@ use std::sync::Arc; use tokio::sync::broadcast; use tokio::sync::broadcast::error::RecvError; +/// TODO docs pub struct Project { pub output_expr: Vec<(Arc, String)>, pub input_schema: SchemaRef, // TODO @@ -15,6 +16,7 @@ pub struct Project { pub children: Vec>, } +/// TODO docs impl Project { pub fn new(input_schema: SchemaRef, projection_plan: &ProjectionExec) -> Self { Self { @@ -42,12 +44,14 @@ impl Project { } } +/// TODO docs impl Operator for Project { fn children(&self) -> Vec> { self.children.clone() } } +/// TODO docs #[async_trait] impl UnaryOperator for Project { type In = RecordBatch;