From 06b0141bf7517bb89aced32d5c213c43f05e1d25 Mon Sep 17 00:00:00 2001 From: Connor Tsui Date: Thu, 30 Jan 2025 09:43:34 -0500 Subject: [PATCH] finish first pass documentation --- optd-core/src/operator/relational/logical/filter.rs | 4 ++++ optd-core/src/operator/relational/logical/join.rs | 6 ++++++ optd-core/src/operator/relational/logical/mod.rs | 1 + optd-core/src/operator/relational/logical/project.rs | 4 ++++ optd-core/src/operator/relational/logical/scan.rs | 6 +++++- optd-core/src/operator/relational/physical/mod.rs | 7 +++++++ optd-core/src/operator/scalar/mod.rs | 4 ++++ 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/optd-core/src/operator/relational/logical/filter.rs b/optd-core/src/operator/relational/logical/filter.rs index 09ffc95..56e72f9 100644 --- a/optd-core/src/operator/relational/logical/filter.rs +++ b/optd-core/src/operator/relational/logical/filter.rs @@ -1,8 +1,12 @@ +//! A logical filter. + /// Logical filter operator that selects rows matching a condition. /// /// Takes input relation (`Relation`) and filters rows using a boolean predicate (`Scalar`). #[derive(Clone)] pub struct Filter { + /// The input relation. pub child: Relation, + /// The filter expression denoting the predicate condition for this filter operation. pub predicate: Scalar, } diff --git a/optd-core/src/operator/relational/logical/join.rs b/optd-core/src/operator/relational/logical/join.rs index c881648..998090e 100644 --- a/optd-core/src/operator/relational/logical/join.rs +++ b/optd-core/src/operator/relational/logical/join.rs @@ -1,11 +1,17 @@ +//! A logical join. + /// Logical join operator that combines rows from two relations. /// /// Takes left and right relations (`Relation`) and joins their rows using a join condition /// (`Scalar`). #[derive(Clone)] pub struct Join { + /// TODO(alexis) Mocked for now. pub join_type: String, + /// The left input relation. pub left: Relation, + /// The right input relation. pub right: Relation, + /// The join expression denoting the join condition that links the two input relations. pub condition: Scalar, } diff --git a/optd-core/src/operator/relational/logical/mod.rs b/optd-core/src/operator/relational/logical/mod.rs index d4db1a0..0821b38 100644 --- a/optd-core/src/operator/relational/logical/mod.rs +++ b/optd-core/src/operator/relational/logical/mod.rs @@ -22,6 +22,7 @@ use scan::Scan; /// [`LogicalPlan`]: crate::plan::logical_plan::LogicalPlan /// [`PartialLogicalPlan`]: crate::plan::partial_logical_plan::PartialLogicalPlan /// [`LogicalExpression`]: crate::expression::LogicalExpression +#[allow(missing_docs)] #[derive(Clone)] pub enum LogicalOperator { Scan(Scan), diff --git a/optd-core/src/operator/relational/logical/project.rs b/optd-core/src/operator/relational/logical/project.rs index 8c8e0dd..656e5f5 100644 --- a/optd-core/src/operator/relational/logical/project.rs +++ b/optd-core/src/operator/relational/logical/project.rs @@ -1,9 +1,13 @@ +//! A logical projection. + /// Logical project operator that specifies output columns. /// /// Takes input relation (`Relation`) and defines output columns/expressions /// (`Scalar`). #[derive(Clone)] pub struct Project { + /// The input relation. pub child: Relation, + /// TODO(everyone): What exactly is going on here? pub fields: Vec, } diff --git a/optd-core/src/operator/relational/logical/scan.rs b/optd-core/src/operator/relational/logical/scan.rs index f7ca18c..0d37113 100644 --- a/optd-core/src/operator/relational/logical/scan.rs +++ b/optd-core/src/operator/relational/logical/scan.rs @@ -1,9 +1,13 @@ +//! A logical scan. + /// Logical scan operator that reads from a base table. /// /// Reads from table (`String`) and optionally filters rows using a pushdown predicate /// (`Scalar`). #[derive(Clone)] pub struct Scan { - pub table_name: String, // TODO(alexis): Mocked for now. + /// TODO(alexis) Mocked for now. + pub table_name: String, + /// An optional filter expression for predicate pushdown into scan operators. pub predicate: Option, } diff --git a/optd-core/src/operator/relational/physical/mod.rs b/optd-core/src/operator/relational/physical/mod.rs index 44fbb4a..9704168 100644 --- a/optd-core/src/operator/relational/physical/mod.rs +++ b/optd-core/src/operator/relational/physical/mod.rs @@ -1,5 +1,11 @@ //! Type definitions of physical operators in optd. +// TODO(connor): +// The module structure here is somewhat questionable, as it has multiple physical operators that +// should really only have 1 implementor (filter and project). +// For now, we can hold off on documenting stuff here until that is stabilized. +#![allow(missing_docs)] + pub mod filter; pub mod join; pub mod project; @@ -22,6 +28,7 @@ use scan::table_scan::TableScan; /// /// [`PhysicalPlan`]: crate::plan::physical_plan::PhysicalPlan /// [`PhysicalExpression`]: crate::expression::PhysicalExpression +#[allow(missing_docs)] #[derive(Clone)] pub enum PhysicalOperator { TableScan(TableScan), diff --git a/optd-core/src/operator/scalar/mod.rs b/optd-core/src/operator/scalar/mod.rs index 169b824..edb4b16 100644 --- a/optd-core/src/operator/scalar/mod.rs +++ b/optd-core/src/operator/scalar/mod.rs @@ -1,4 +1,8 @@ //! Type definitions for scalar operators. + +// For now, we can hold off on documenting stuff here until that is stabilized. +#![allow(missing_docs)] + pub mod add; pub mod column_ref; pub mod constants;