Apache DataFusion SQL Query Engine
Remove TableSource::supports_filter_pushdown function (#12239)
Piotr Findeisenf9b14693228c
diff --git a/datafusion/expr/src/table_source.rs b/datafusion/expr/src/table_source.rsindex 8b8d2dfcf2..bdb602d48d 100644--- a/datafusion/expr/src/table_source.rs+++ b/datafusion/expr/src/table_source.rs@@ -98,27 +98,15 @@ pub trait TableSource: Sync + Send {TableType::Base}- /// Tests whether the table provider can make use of a filter expression- /// to optimise data retrieval.- #[deprecated(since = "20.0.0", note = "use supports_filters_pushdown instead")]- fn supports_filter_pushdown(- &self,- _filter: &Expr,- ) -> Result<TableProviderFilterPushDown> {- Ok(TableProviderFilterPushDown::Unsupported)- }-/// Tests whether the table provider can make use of any or all filter expressions/// to optimise data retrieval.- #[allow(deprecated)]fn supports_filters_pushdown(&self,filters: &[&Expr],) -> Result<Vec<TableProviderFilterPushDown>> {- filters- .iter()- .map(|f| self.supports_filter_pushdown(f))- .collect()+ Ok((0..filters.len())+ .map(|_| TableProviderFilterPushDown::Unsupported)+ .collect())}/// Get the Logical plan of this table provider, if available.diff --git a/datafusion/optimizer/src/analyzer/inline_table_scan.rs b/datafusion/optimizer/src/analyzer/inline_table_scan.rsindex d5b3648725..2fc9b91da6 100644--- a/datafusion/optimizer/src/analyzer/inline_table_scan.rs+++ b/datafusion/optimizer/src/analyzer/inline_table_scan.rs@@ -109,7 +109,7 @@ mod tests {use crate::test::assert_analyzed_plan_eq;use arrow::datatypes::{DataType, Field, Schema};- use datafusion_expr::{col, lit, LogicalPlan, LogicalPlanBuilder, TableSource};+ use datafusion_expr::{col, lit, Expr, LogicalPlan, LogicalPlanBuilder, TableSource};pub struct RawTableSource {}@@ -125,12 +125,14 @@ mod tests {]))}- fn supports_filter_pushdown(+ fn supports_filters_pushdown(&self,- _filter: &datafusion_expr::Expr,- ) -> datafusion_common::Result<datafusion_expr::TableProviderFilterPushDown>+ filters: &[&Expr],+ ) -> datafusion_common::Result<Vec<datafusion_expr::TableProviderFilterPushDown>>{- Ok(datafusion_expr::TableProviderFilterPushDown::Inexact)+ Ok((0..filters.len())+ .map(|_| datafusion_expr::TableProviderFilterPushDown::Inexact)+ .collect())}}@@ -154,12 +156,14 @@ mod tests {self}- fn supports_filter_pushdown(+ fn supports_filters_pushdown(&self,- _filter: &datafusion_expr::Expr,- ) -> datafusion_common::Result<datafusion_expr::TableProviderFilterPushDown>+ filters: &[&Expr],+ ) -> datafusion_common::Result<Vec<datafusion_expr::TableProviderFilterPushDown>>{- Ok(datafusion_expr::TableProviderFilterPushDown::Exact)+ Ok((0..filters.len())+ .map(|_| datafusion_expr::TableProviderFilterPushDown::Exact)+ .collect())}fn schema(&self) -> arrow::datatypes::SchemaRef {diff --git a/datafusion/optimizer/src/push_down_filter.rs b/datafusion/optimizer/src/push_down_filter.rsindex 33a58a810b..0625652a6b 100644--- a/datafusion/optimizer/src/push_down_filter.rs+++ b/datafusion/optimizer/src/push_down_filter.rs@@ -2416,11 +2416,13 @@ mod tests {TableType::Base}- fn supports_filter_pushdown(+ fn supports_filters_pushdown(&self,- _e: &Expr,- ) -> Result<TableProviderFilterPushDown> {- Ok(self.filter_support.clone())+ filters: &[&Expr],+ ) -> Result<Vec<TableProviderFilterPushDown>> {+ Ok((0..filters.len())+ .map(|_| self.filter_support.clone())+ .collect())}fn as_any(&self) -> &dyn std::any::Any {