milenkovicm commented on code in PR #1428: URL: https://github.com/apache/datafusion-ballista/pull/1428#discussion_r2749643052
########## ballista/scheduler/src/job_split_rules/mod.rs: ########## @@ -0,0 +1,148 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Job Split Rules +//! +//! This module provides a trait-based system for splitting jobs into +//! dependent sub-jobs. Rules can be registered and applied automatically +//! when processing queries. + +use ballista_core::error::Result; +use datafusion::logical_expr::LogicalPlan; +use std::sync::Arc; + +/// Represents a split job with upstream and downstream components +#[derive(Debug, Clone)] +pub struct SplitJobPlan { + /// The upstream job plan (executes first) + pub upstream_plan: Arc<LogicalPlan>, + /// The downstream job plan (waits for upstream to complete) + pub downstream_plan: Arc<LogicalPlan>, +} + +/// Trait for job splitting rules +pub trait JobSplitRule: Send + Sync { + /// Returns the name of this rule (for logging) + fn name(&self) -> &str; + + /// Checks if this rule can split the given logical plan + fn can_split(&self, plan: &LogicalPlan) -> Result<bool>; + + /// Applies the split rule to the logical plan + fn apply(&self, plan: &LogicalPlan) -> Result<SplitJobPlan>; +} + +/// Registry for job split rules +/// +/// Manages a collection of rules and provides methods to apply them to plans. +#[derive(Clone)] Review Comment: do we need plan `JobSplitRegistry`? can this be done as part of custom query planner ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
