Skip to content
Merged
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
18 changes: 3 additions & 15 deletions datafusion/expr/src/table_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 13 additions & 9 deletions datafusion/optimizer/src/analyzer/inline_table_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand All @@ -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())
}
}

Expand All @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions datafusion/optimizer/src/push_down_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2417,11 +2417,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 {
Expand Down