From f29942867ec0050a6851f3b16986e37f2a87e638 Mon Sep 17 00:00:00 2001 From: Phillip LeBlanc Date: Sat, 25 May 2024 00:04:18 +0900 Subject: [PATCH] Fix the fallback to the table provider for supports_filters_pushdown --- datafusion-federation/src/table_provider.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/datafusion-federation/src/table_provider.rs b/datafusion-federation/src/table_provider.rs index c01ec9b..a1acc30 100644 --- a/datafusion-federation/src/table_provider.rs +++ b/datafusion-federation/src/table_provider.rs @@ -7,7 +7,7 @@ use datafusion::{ datasource::TableProvider, error::{DataFusionError, Result}, execution::context::SessionState, - logical_expr::{Expr, LogicalPlan, TableSource, TableType}, + logical_expr::{Expr, LogicalPlan, TableProviderFilterPushDown, TableSource, TableType}, physical_plan::ExecutionPlan, }; @@ -88,6 +88,19 @@ impl TableProvider for FederatedTableProviderAdaptor { self.source.get_column_default(column) } + fn supports_filters_pushdown( + &self, + filters: &[&Expr], + ) -> Result> { + if let Some(table_provider) = &self.table_provider { + return table_provider.supports_filters_pushdown(filters); + } + + Ok(vec![ + TableProviderFilterPushDown::Unsupported; + filters.len() + ]) + } // Scan is not supported; the adaptor should be replaced // with a virtual TableProvider that provides federation for a sub-plan.