Skip to content

Commit

Permalink
Rename ops to logical_ops
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkzinzow committed Sep 8, 2023
1 parent a68db03 commit abd66fe
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 22 deletions.
32 changes: 17 additions & 15 deletions src/daft-plan/src/builder.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;

use crate::{
logical_ops,
logical_plan::LogicalPlan,
ops,
optimization::Optimizer,
planner::plan,
sink_info::{OutputFileInfo, SinkInfo},
Expand Down Expand Up @@ -50,7 +50,7 @@ impl LogicalPlanBuilder {
partition_key.into(),
cache_entry,
));
let logical_plan: LogicalPlan = ops::Source::new(
let logical_plan: LogicalPlan = logical_ops::Source::new(
schema.clone(),
source_info.into(),
partition_spec.clone().into(),
Expand Down Expand Up @@ -85,7 +85,7 @@ impl LogicalPlanBuilder {
));
let partition_spec =
PartitionSpec::new_internal(PartitionScheme::Unknown, num_partitions, None);
let logical_plan: LogicalPlan = ops::Source::new(
let logical_plan: LogicalPlan = logical_ops::Source::new(
schema.clone(),
source_info.into(),
partition_spec.into(),
Expand All @@ -101,29 +101,30 @@ impl LogicalPlanBuilder {
resource_request: ResourceRequest,
) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Project::try_new(self.plan.clone(), projection, resource_request)?.into();
logical_ops::Project::try_new(self.plan.clone(), projection, resource_request)?.into();
Ok(logical_plan.into())
}

pub fn filter(&self, predicate: Expr) -> DaftResult<Self> {
let logical_plan: LogicalPlan = ops::Filter::try_new(self.plan.clone(), predicate)?.into();
let logical_plan: LogicalPlan =
logical_ops::Filter::try_new(self.plan.clone(), predicate)?.into();
Ok(logical_plan.into())
}

pub fn limit(&self, limit: i64) -> DaftResult<Self> {
let logical_plan: LogicalPlan = ops::Limit::new(self.plan.clone(), limit).into();
let logical_plan: LogicalPlan = logical_ops::Limit::new(self.plan.clone(), limit).into();
Ok(logical_plan.into())
}

pub fn explode(&self, to_explode: Vec<Expr>) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Explode::try_new(self.plan.clone(), to_explode)?.into();
logical_ops::Explode::try_new(self.plan.clone(), to_explode)?.into();
Ok(logical_plan.into())
}

pub fn sort(&self, sort_by: Vec<Expr>, descending: Vec<bool>) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Sort::try_new(self.plan.clone(), sort_by, descending)?.into();
logical_ops::Sort::try_new(self.plan.clone(), sort_by, descending)?.into();
Ok(logical_plan.into())
}

Expand All @@ -134,18 +135,19 @@ impl LogicalPlanBuilder {
scheme: PartitionScheme,
) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Repartition::new(self.plan.clone(), num_partitions, partition_by, scheme).into();
logical_ops::Repartition::new(self.plan.clone(), num_partitions, partition_by, scheme)
.into();
Ok(logical_plan.into())
}

pub fn coalesce(&self, num_partitions: usize) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Coalesce::new(self.plan.clone(), num_partitions).into();
logical_ops::Coalesce::new(self.plan.clone(), num_partitions).into();
Ok(logical_plan.into())
}

pub fn distinct(&self) -> DaftResult<Self> {
let logical_plan: LogicalPlan = ops::Distinct::new(self.plan.clone()).into();
let logical_plan: LogicalPlan = logical_ops::Distinct::new(self.plan.clone()).into();
Ok(logical_plan.into())
}

Expand All @@ -161,7 +163,7 @@ impl LogicalPlanBuilder {
.collect::<DaftResult<Vec<daft_dsl::AggExpr>>>()?;

let logical_plan: LogicalPlan =
ops::Aggregate::try_new(self.plan.clone(), agg_exprs, groupby_exprs)?.into();
logical_ops::Aggregate::try_new(self.plan.clone(), agg_exprs, groupby_exprs)?.into();
Ok(logical_plan.into())
}

Expand All @@ -172,7 +174,7 @@ impl LogicalPlanBuilder {
right_on: Vec<Expr>,
join_type: JoinType,
) -> DaftResult<Self> {
let logical_plan: LogicalPlan = ops::Join::try_new(
let logical_plan: LogicalPlan = logical_ops::Join::try_new(
self.plan.clone(),
other.plan.clone(),
left_on,
Expand All @@ -185,7 +187,7 @@ impl LogicalPlanBuilder {

pub fn concat(&self, other: &Self) -> DaftResult<Self> {
let logical_plan: LogicalPlan =
ops::Concat::try_new(self.plan.clone(), other.plan.clone())?.into();
logical_ops::Concat::try_new(self.plan.clone(), other.plan.clone())?.into();
Ok(logical_plan.into())
}

Expand All @@ -203,7 +205,7 @@ impl LogicalPlanBuilder {
compression,
));
let fields = vec![Field::new("path", DataType::Utf8)];
let logical_plan: LogicalPlan = ops::Sink::new(
let logical_plan: LogicalPlan = logical_ops::Sink::new(
self.plan.clone(),
Schema::new(fields)?.into(),
sink_info.into(),
Expand Down
2 changes: 1 addition & 1 deletion src/daft-plan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
mod builder;
mod display;
mod join;
mod logical_ops;
mod logical_plan;
mod ops;
mod optimization;
mod partitioning;
mod physical_ops;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/daft-plan/src/logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use daft_dsl::{optimization::get_required_columns, Expr};
use indexmap::IndexSet;
use snafu::Snafu;

use crate::{display::TreeDisplay, ops::*, PartitionScheme, PartitionSpec};
use crate::{display::TreeDisplay, logical_ops::*, PartitionScheme, PartitionSpec};

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum LogicalPlan {
Expand Down
2 changes: 1 addition & 1 deletion src/daft-plan/src/optimization/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ mod tests {
use daft_dsl::{col, lit};

use crate::{
ops::{Filter, Project},
logical_ops::{Filter, Project},
optimization::rules::{ApplyOrder, OptimizerRule, Transformed},
test::dummy_scan_node,
LogicalPlan,
Expand Down
2 changes: 1 addition & 1 deletion src/daft-plan/src/optimization/rules/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use daft_dsl::{
};

use crate::{
ops::{Concat, Filter, Project},
logical_ops::{Concat, Filter, Project},
LogicalPlan,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use daft_dsl::Expr;
use indexmap::IndexSet;

use crate::{
ops::{Aggregate, Project, Source},
logical_ops::{Aggregate, Project, Source},
LogicalPlan,
};

Expand Down
4 changes: 2 additions & 2 deletions src/daft-plan/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use common_error::DaftResult;
use daft_core::count_mode::CountMode;
use daft_dsl::Expr;

use crate::logical_plan::LogicalPlan;
use crate::ops::{
use crate::logical_ops::{
Aggregate as LogicalAggregate, Coalesce as LogicalCoalesce, Concat as LogicalConcat,
Distinct as LogicalDistinct, Explode as LogicalExplode, Filter as LogicalFilter,
Join as LogicalJoin, Limit as LogicalLimit, Project as LogicalProject,
Repartition as LogicalRepartition, Sink as LogicalSink, Sort as LogicalSort, Source,
};
use crate::logical_plan::LogicalPlan;
use crate::physical_plan::PhysicalPlan;
use crate::sink_info::{OutputFileInfo, SinkInfo};
use crate::source_info::{ExternalInfo as ExternalSourceInfo, FileFormatConfig, SourceInfo};
Expand Down

0 comments on commit abd66fe

Please sign in to comment.