use super::{ExchangeOp, GraphOp, PhysicalPlan, QueryOp};
pub fn plan_contains_cluster_partitioned_leaf(plan: &PhysicalPlan) -> bool {
match plan {
PhysicalPlan::Query(QueryOp::Aggregate { input, .. }) => match input {
Some(child) => plan_contains_cluster_partitioned_leaf(child),
None => false,
},
PhysicalPlan::Query(QueryOp::HashJoin {
left_input,
right_input,
left_bitmap,
right_bitmap,
..
}) => {
left_input
.as_deref()
.map(plan_contains_cluster_partitioned_leaf)
.unwrap_or(false)
|| right_input
.as_deref()
.map(plan_contains_cluster_partitioned_leaf)
.unwrap_or(false)
|| left_bitmap
.as_deref()
.map(plan_contains_cluster_partitioned_leaf)
.unwrap_or(false)
|| right_bitmap
.as_deref()
.map(plan_contains_cluster_partitioned_leaf)
.unwrap_or(false)
}
PhysicalPlan::Query(QueryOp::Exchange(ExchangeOp { child, .. })) => {
plan_contains_cluster_partitioned_leaf(child)
}
PhysicalPlan::Query(QueryOp::LateralTopK { outer_plan, .. })
| PhysicalPlan::Query(QueryOp::LateralLoop { outer_plan, .. }) => {
plan_contains_cluster_partitioned_leaf(outer_plan)
}
PhysicalPlan::Graph(GraphOp::Hop { .. })
| PhysicalPlan::Graph(GraphOp::Neighbors { .. })
| PhysicalPlan::Graph(GraphOp::NeighborsMulti { .. })
| PhysicalPlan::Graph(GraphOp::Path { .. })
| PhysicalPlan::Graph(GraphOp::Subgraph { .. })
| PhysicalPlan::Graph(GraphOp::RagFusion { .. })
| PhysicalPlan::Graph(GraphOp::Algo { .. })
| PhysicalPlan::Graph(GraphOp::Match { .. })
| PhysicalPlan::Graph(GraphOp::MatchContinuation { .. })
| PhysicalPlan::Graph(GraphOp::MatchVarLenResume { .. })
| PhysicalPlan::Graph(GraphOp::TemporalNeighbors { .. })
| PhysicalPlan::Graph(GraphOp::TemporalAlgorithm { .. })
| PhysicalPlan::Graph(GraphOp::BspSuperstep(_))
| PhysicalPlan::Graph(GraphOp::WccSuperstep(_))
| PhysicalPlan::Graph(GraphOp::Stats { .. }) => true,
PhysicalPlan::Array(_) | PhysicalPlan::ClusterArray(_) => true,
PhysicalPlan::Graph(GraphOp::EdgePut { .. })
| PhysicalPlan::Graph(GraphOp::EdgePutBatch { .. })
| PhysicalPlan::Graph(GraphOp::EdgeDelete { .. })
| PhysicalPlan::Graph(GraphOp::EdgeDeleteBatch { .. })
| PhysicalPlan::Graph(GraphOp::SetNodeLabels { .. })
| PhysicalPlan::Graph(GraphOp::RemoveNodeLabels { .. })
| PhysicalPlan::Vector(_)
| PhysicalPlan::Document(_)
| PhysicalPlan::Kv(_)
| PhysicalPlan::Text(_)
| PhysicalPlan::Columnar(_)
| PhysicalPlan::Timeseries(_)
| PhysicalPlan::Spatial(_)
| PhysicalPlan::Crdt(_)
| PhysicalPlan::Meta(_)
| PhysicalPlan::Query(QueryOp::ProviderScan { .. })
| PhysicalPlan::Query(QueryOp::PartialAggregate { .. })
| PhysicalPlan::Query(QueryOp::PartialAggregateState { .. })
| PhysicalPlan::Query(QueryOp::ShuffleJoinConsume { .. })
| PhysicalPlan::Query(QueryOp::ShuffleAggregateConsume { .. })
| PhysicalPlan::Query(QueryOp::NestedLoopJoin { .. })
| PhysicalPlan::Query(QueryOp::SortMergeJoin { .. })
| PhysicalPlan::Query(QueryOp::FacetCounts { .. })
| PhysicalPlan::Query(QueryOp::RecursiveScan { .. })
| PhysicalPlan::Query(QueryOp::RecursiveValue { .. }) => false,
}
}