Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
add todos
Browse files Browse the repository at this point in the history
  • Loading branch information
connortsui20 committed Feb 25, 2024
1 parent 2256190 commit e025452
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eggstrain/src/execution/operators/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn PhysicalExpr>,
pub children: Vec<Arc<dyn ExecutionPlan>>,
}

/// TODO docs
impl Filter {
pub fn new(predicate: Arc<dyn PhysicalExpr>, children: Vec<Arc<dyn ExecutionPlan>>) -> Self {
Self {
Expand All @@ -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<RecordBatch> {
self.predicate
.evaluate(&batch)
Expand All @@ -36,12 +39,14 @@ impl Filter {
}
}

/// TODO docs
impl Operator for Filter {
fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
self.children.clone()
}
}

/// TODO docs
#[async_trait]
impl UnaryOperator for Filter {
type In = RecordBatch;
Expand Down
9 changes: 9 additions & 0 deletions eggstrain/src/execution/operators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<dyn ExecutionPlan>>;
}

/// Defines shared behavior for operators with a single logical input
///
/// TODO docs
#[async_trait]
pub(crate) trait UnaryOperator: Operator + Send + Sync {
type In;
Expand All @@ -20,6 +26,9 @@ pub(crate) trait UnaryOperator: Operator + Send + Sync {
async fn execute(&self, rx: Receiver<Self::In>, tx: Sender<Self::Out>);
}

/// 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;
Expand Down
4 changes: 4 additions & 0 deletions eggstrain/src/execution/operators/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ use std::sync::Arc;
use tokio::sync::broadcast;
use tokio::sync::broadcast::error::RecvError;

/// TODO docs
pub struct Project {
pub output_expr: Vec<(Arc<dyn PhysicalExpr>, String)>,
pub input_schema: SchemaRef, // TODO
pub output_schema: SchemaRef,
pub children: Vec<Arc<dyn ExecutionPlan>>,
}

/// TODO docs
impl Project {
pub fn new(input_schema: SchemaRef, projection_plan: &ProjectionExec) -> Self {
Self {
Expand Down Expand Up @@ -42,12 +44,14 @@ impl Project {
}
}

/// TODO docs
impl Operator for Project {
fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
self.children.clone()
}
}

/// TODO docs
#[async_trait]
impl UnaryOperator for Project {
type In = RecordBatch;
Expand Down

0 comments on commit e025452

Please sign in to comment.