Skip to content

Commit

Permalink
TODO: implement new trait methods for ExcutionPlan and ExecutionPlanP…
Browse files Browse the repository at this point in the history
…roperties
  • Loading branch information
Michael-J-Ward committed May 1, 2024
1 parent 8c4c4bf commit 174381b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
42 changes: 28 additions & 14 deletions src/dataset_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ use datafusion::execution::context::TaskContext;
use datafusion::physical_expr::PhysicalSortExpr;
use datafusion::physical_plan::stream::RecordBatchStreamAdapter;
use datafusion::physical_plan::{
DisplayAs, DisplayFormatType, ExecutionPlan, Partitioning, SendableRecordBatchStream,
Statistics,
DisplayAs, DisplayFormatType, ExecutionPlan, ExecutionPlanProperties, Partitioning,
SendableRecordBatchStream, Statistics,
};
use datafusion_expr::utils::conjunction;
use datafusion_expr::Expr;
Expand Down Expand Up @@ -156,18 +156,6 @@ impl ExecutionPlan for DatasetExec {
self.schema.clone()
}

/// Get the output partitioning of this plan
fn output_partitioning(&self) -> Partitioning {
Python::with_gil(|py| {
let fragments = self.fragments.as_ref(py);
Partitioning::UnknownPartitioning(fragments.len())
})
}

fn output_ordering(&self) -> Option<&[PhysicalSortExpr]> {
None
}

fn children(&self) -> Vec<Arc<dyn ExecutionPlan>> {
// this is a leaf node and has no children
vec![]
Expand Down Expand Up @@ -240,6 +228,32 @@ impl ExecutionPlan for DatasetExec {
fn statistics(&self) -> DFResult<Statistics> {
Ok(self.projected_statistics.clone())
}

fn properties(&self) -> &datafusion::physical_plan::PlanProperties {
todo!()
}
}

impl ExecutionPlanProperties for DatasetExec {
/// Get the output partitioning of this plan
fn output_partitioning(&self) -> &Partitioning {
&Python::with_gil(|py| {
let fragments = self.fragments.as_ref(py);
Partitioning::UnknownPartitioning(fragments.len())
})
}

fn output_ordering(&self) -> Option<&[PhysicalSortExpr]> {
None
}

fn execution_mode(&self) -> datafusion::physical_plan::ExecutionMode {
todo!()
}

fn equivalence_properties(&self) -> &datafusion::physical_expr::EquivalenceProperties {
todo!()
}
}

impl DisplayAs for DatasetExec {
Expand Down
2 changes: 1 addition & 1 deletion src/physical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use datafusion::physical_plan::{displayable, ExecutionPlan};
use datafusion::physical_plan::{displayable, ExecutionPlan, ExecutionPlanProperties};
use std::sync::Arc;

use pyo3::prelude::*;
Expand Down

0 comments on commit 174381b

Please sign in to comment.