Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use async_trait::async_trait;
use datafusion::arrow::array::{UInt8Builder, UInt64Builder};
use datafusion::arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use datafusion::arrow::record_batch::RecordBatch;
use datafusion::common::tree_node::TreeNodeRecursion;
use datafusion::datasource::{TableProvider, TableType, provider_as_source};
use datafusion::error::Result;
use datafusion::execution::context::TaskContext;
Expand Down Expand Up @@ -275,20 +274,4 @@ impl ExecutionPlan for CustomExec {
None,
)?))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use arrow::record_batch::RecordBatch;
use arrow_schema::SchemaRef;
use datafusion::common::record_batch;
use datafusion::common::tree_node::TreeNodeRecursion;
use datafusion::common::{exec_datafusion_err, internal_err};
use datafusion::datasource::{DefaultTableSource, memory::MemTable};
use datafusion::error::Result;
Expand Down Expand Up @@ -292,20 +291,4 @@ impl ExecutionPlan for BufferingExecutionPlan {
}),
)))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.properties.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}
19 changes: 0 additions & 19 deletions datafusion-examples/examples/proto/composed_extension_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use std::sync::Arc;

use datafusion::common::Result;
use datafusion::common::internal_err;
use datafusion::common::tree_node::TreeNodeRecursion;
use datafusion::execution::TaskContext;
use datafusion::physical_plan::{DisplayAs, ExecutionPlan};
use datafusion::prelude::SessionContext;
Expand Down Expand Up @@ -125,15 +124,6 @@ impl ExecutionPlan for ParentExec {
) -> Result<datafusion::physical_plan::SendableRecordBatchStream> {
unreachable!()
}

fn apply_expressions(
&self,
_f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}

/// A PhysicalExtensionCodec that can serialize and deserialize ParentExec
Expand Down Expand Up @@ -212,15 +202,6 @@ impl ExecutionPlan for ChildExec {
) -> Result<datafusion::physical_plan::SendableRecordBatchStream> {
unreachable!()
}

fn apply_expressions(
&self,
_f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}

/// A PhysicalExtensionCodec that can serialize and deserialize ChildExec
Expand Down
18 changes: 1 addition & 17 deletions datafusion-examples/examples/relation_planner/table_sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ use datafusion::{
};
use datafusion_common::{
DFSchemaRef, DataFusionError, Result, Statistics, internal_err, not_impl_err,
plan_datafusion_err, plan_err, tree_node::TreeNodeRecursion,
plan_datafusion_err, plan_err,
};
use datafusion_expr::{
UserDefinedLogicalNode, UserDefinedLogicalNodeCore,
Expand Down Expand Up @@ -738,22 +738,6 @@ impl ExecutionPlan for SampleExec {

Ok(Arc::new(stats))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}

/// Bernoulli sampler: includes each row with probability `(upper - lower)`.
Expand Down
12 changes: 2 additions & 10 deletions datafusion/catalog/src/memory/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use arrow::compute::{and, filter_record_batch};
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use arrow::record_batch::RecordBatch;
use datafusion_common::error::Result;
use datafusion_common::tree_node::TreeNodeRecursion;
use datafusion_common::{Constraints, DFSchema, SchemaExt, not_impl_err, plan_err};
use datafusion_common_runtime::JoinSet;
use datafusion_datasource::memory::{MemSink, MemorySourceConfig};
Expand All @@ -40,13 +39,13 @@ use datafusion_datasource::source::DataSourceExec;
use datafusion_expr::dml::InsertOp;
use datafusion_expr::{Expr, SortExpr, TableType};
use datafusion_physical_expr::{
LexOrdering, create_physical_expr, create_physical_sort_exprs,
LexOrdering, PhysicalExpr, create_physical_expr, create_physical_sort_exprs,
};
use datafusion_physical_plan::repartition::RepartitionExec;
use datafusion_physical_plan::stream::RecordBatchStreamAdapter;
use datafusion_physical_plan::{
DisplayAs, DisplayFormatType, ExecutionPlan, ExecutionPlanProperties, Partitioning,
PhysicalExpr, PlanProperties, common,
PlanProperties, common,
};
use datafusion_session::Session;

Expand Down Expand Up @@ -627,11 +626,4 @@ impl ExecutionPlan for DmlResultExec {
stream,
)))
}

fn apply_expressions(
&self,
_f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}
32 changes: 0 additions & 32 deletions datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4475,20 +4475,6 @@ mod tests {
) -> Result<SendableRecordBatchStream> {
unimplemented!("NoOpExecutionPlan::execute");
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}

// Produces an execution plan where the schema is mismatched from
Expand Down Expand Up @@ -4628,12 +4614,6 @@ digraph {
) -> Result<SendableRecordBatchStream> {
unimplemented!()
}
fn apply_expressions(
&self,
_f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}
impl DisplayAs for OkExtensionNode {
fn fmt_as(&self, _t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -4680,12 +4660,6 @@ digraph {
) -> Result<SendableRecordBatchStream> {
unimplemented!()
}
fn apply_expressions(
&self,
_f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}
impl DisplayAs for InvariantFailsExtensionNode {
fn fmt_as(&self, _t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down Expand Up @@ -4804,12 +4778,6 @@ digraph {
) -> Result<SendableRecordBatchStream> {
unimplemented!()
}
fn apply_expressions(
&self,
_f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}
}
impl DisplayAs for ExecutableInvariantFails {
fn fmt_as(&self, _t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
17 changes: 0 additions & 17 deletions datafusion/core/tests/custom_sources_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use datafusion_catalog::Session;
use datafusion_common::cast::as_primitive_array;
use datafusion_common::project_schema;
use datafusion_common::stats::Precision;
use datafusion_common::tree_node::TreeNodeRecursion;
use datafusion_physical_expr::EquivalenceProperties;
use datafusion_physical_plan::PlanProperties;
use datafusion_physical_plan::execution_plan::{Boundedness, EmissionType};
Expand Down Expand Up @@ -205,22 +204,6 @@ impl ExecutionPlan for CustomExecutionPlan {
.collect(),
}))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}

#[async_trait]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use datafusion::prelude::*;
use datafusion::scalar::ScalarValue;
use datafusion_catalog::Session;
use datafusion_common::cast::as_primitive_array;
use datafusion_common::tree_node::TreeNodeRecursion;
use datafusion_common::{DataFusionError, internal_err, not_impl_err};
use datafusion_expr::expr::{BinaryExpr, Cast};
use datafusion_functions_aggregate::expr_fn::count;
Expand Down Expand Up @@ -149,22 +148,6 @@ impl ExecutionPlan for CustomPlan {
})),
)))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}

#[derive(Clone, Debug)]
Expand Down
17 changes: 0 additions & 17 deletions datafusion/core/tests/custom_sources_cases/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use datafusion::{
scalar::ScalarValue,
};
use datafusion_catalog::Session;
use datafusion_common::tree_node::TreeNodeRecursion;
use datafusion_common::{project_schema, stats::Precision};
use datafusion_physical_expr::EquivalenceProperties;
use datafusion_physical_plan::execution_plan::{Boundedness, EmissionType};
Expand Down Expand Up @@ -181,22 +180,6 @@ impl ExecutionPlan for StatisticsValidation {
Ok(Arc::new(self.stats.clone()))
}
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion::physical_plan::PhysicalExpr,
) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}

fn init_ctx(stats: Statistics, schema: Schema) -> Result<SessionContext> {
Expand Down
17 changes: 0 additions & 17 deletions datafusion/core/tests/fuzz_cases/once_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

use arrow_schema::SchemaRef;
use datafusion_common::internal_datafusion_err;
use datafusion_common::tree_node::TreeNodeRecursion;
use datafusion_execution::{SendableRecordBatchStream, TaskContext};
use datafusion_physical_expr::{EquivalenceProperties, Partitioning};
use datafusion_physical_plan::execution_plan::{Boundedness, EmissionType};
Expand Down Expand Up @@ -106,20 +105,4 @@ impl ExecutionPlan for OnceExec {

stream.ok_or_else(|| internal_datafusion_err!("Stream already consumed"))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(
&dyn datafusion_physical_plan::PhysicalExpr,
) -> datafusion_common::Result<TreeNodeRecursion>,
) -> datafusion_common::Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}
}
25 changes: 1 addition & 24 deletions datafusion/core/tests/physical_optimizer/enforce_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ use datafusion::prelude::{SessionConfig, SessionContext};
use datafusion_common::ScalarValue;
use datafusion_common::config::CsvOptions;
use datafusion_common::error::Result;
use datafusion_common::tree_node::{
Transformed, TransformedResult, TreeNode, TreeNodeRecursion,
};
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
use datafusion_datasource::file_groups::FileGroup;
use datafusion_datasource::file_scan_config::FileScanConfigBuilder;
use datafusion_expr::{JoinType, Operator};
Expand Down Expand Up @@ -203,20 +201,6 @@ impl ExecutionPlan for SortRequiredExec {
)))
}

fn apply_expressions(
&self,
f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
// Visit expressions in the output ordering from equivalence properties
let mut tnr = TreeNodeRecursion::Continue;
if let Some(ordering) = self.cache.output_ordering() {
for sort_expr in ordering {
tnr = tnr.visit_sibling(|| f(sort_expr.expr.as_ref()))?;
}
}
Ok(tnr)
}

fn execute(
&self,
_partition: usize,
Expand Down Expand Up @@ -300,13 +284,6 @@ impl ExecutionPlan for SinglePartitionMaintainsOrderExec {
Ok(Arc::new(Self::new(child)))
}

fn apply_expressions(
&self,
_f: &mut dyn FnMut(&dyn PhysicalExpr) -> Result<TreeNodeRecursion>,
) -> Result<TreeNodeRecursion> {
Ok(TreeNodeRecursion::Continue)
}

fn execute(
&self,
_partition: usize,
Expand Down
Loading
Loading