Skip to content

Commit

Permalink
Remove deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Apr 3, 2024
1 parent 3b962d3 commit 61b4193
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 34 deletions.
8 changes: 4 additions & 4 deletions datafusion/core/src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,12 +1430,12 @@ impl TableProvider for DataFrameTableProvider {
Some(&self.plan)
}

fn supports_filter_pushdown(
fn supports_filters_pushdown(
&self,
_filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>> {
// A filter is added on the DataFrame when given
Ok(TableProviderFilterPushDown::Exact)
Ok(vec![TableProviderFilterPushDown::Exact; filters.len()])
}

fn schema(&self) -> SchemaRef {
Expand Down
11 changes: 7 additions & 4 deletions datafusion/core/src/datasource/cte_worktable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ impl TableProvider for CteWorkTable {
)))
}

fn supports_filter_pushdown(
fn supports_filters_pushdown(
&self,
_filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>> {
// TODO: should we support filter pushdown?
Ok(TableProviderFilterPushDown::Unsupported)
Ok(vec![
TableProviderFilterPushDown::Unsupported;
filters.len()
])
}
}
44 changes: 25 additions & 19 deletions datafusion/core/src/datasource/listing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,26 +685,32 @@ impl TableProvider for ListingTable {
.await
}

fn supports_filter_pushdown(
fn supports_filters_pushdown(
&self,
filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
if expr_applicable_for_cols(
&self
.options
.table_partition_cols
.iter()
.map(|x| x.0.clone())
.collect::<Vec<_>>(),
filter,
) {
// if filter can be handled by partiton pruning, it is exact
Ok(TableProviderFilterPushDown::Exact)
} else {
// otherwise, we still might be able to handle the filter with file
// level mechanisms such as Parquet row group pruning.
Ok(TableProviderFilterPushDown::Inexact)
}
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>> {
let support: Vec<_> = filters
.iter()
.map(|filter| {
if expr_applicable_for_cols(
&self
.options
.table_partition_cols
.iter()
.map(|x| x.0.clone())
.collect::<Vec<_>>(),
filter,
) {
// if filter can be handled by partition pruning, it is exact
TableProviderFilterPushDown::Exact
} else {
// otherwise, we still might be able to handle the filter with file
// level mechanisms such as Parquet row group pruning.
TableProviderFilterPushDown::Inexact
}
})
.collect();
Ok(support)
}

fn get_table_definition(&self) -> Option<&str> {
Expand Down
9 changes: 4 additions & 5 deletions datafusion/core/src/datasource/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ impl TableProvider for ViewTable {
fn get_table_definition(&self) -> Option<&str> {
self.definition.as_deref()
}

fn supports_filter_pushdown(
fn supports_filters_pushdown(
&self,
_filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>> {
// A filter is added on the View when given
Ok(TableProviderFilterPushDown::Exact)
Ok(vec![TableProviderFilterPushDown::Exact; filters.len()])
}

async fn scan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ impl TableProvider for CustomProvider {
}
}

fn supports_filter_pushdown(&self, _: &Expr) -> Result<TableProviderFilterPushDown> {
Ok(TableProviderFilterPushDown::Exact)
fn supports_filters_pushdown(
&self,
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>> {
Ok(vec![TableProviderFilterPushDown::Exact; filters.len()])
}
}

Expand Down

0 comments on commit 61b4193

Please sign in to comment.