From 0eaf193071285c99966344b69d359d80c341f057 Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Tue, 10 Sep 2024 10:42:00 -0500 Subject: [PATCH] update impl TableSource for SqlTableSource The (singular) `TableSource::supports_filter_pushdown` was removed upstream. [1] I simply moved the method to the private `SqlTableSource::supports_filter_pushdown` because it is still used by the (plural) `TableSource::supports_filters_pushdown`. Additionally, the return type of `TableSource::get_logical_plan` was changed to Option> upstream. [2] Refs [1]: https://github.com/apache/datafusion/pull/12239 [2]: https://github.com/apache/datafusion/pull/12113 --- src/common/schema.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/schema.rs b/src/common/schema.rs index 5806c90e2..64a102038 100644 --- a/src/common/schema.rs +++ b/src/common/schema.rs @@ -16,6 +16,7 @@ // under the License. use std::any::Any; +use std::borrow::Cow; use datafusion::arrow::datatypes::SchemaRef; use datafusion::logical_expr::{Expr, TableProviderFilterPushDown, TableSource}; @@ -151,17 +152,6 @@ impl SqlTableSource { pub fn filepaths(&self) -> Option<&Vec> { self.filepaths.as_ref() } -} - -/// Implement TableSource, used in the logical query plan and in logical query optimizations -impl TableSource for SqlTableSource { - fn as_any(&self) -> &dyn Any { - self - } - - fn schema(&self) -> SchemaRef { - self.schema.clone() - } fn supports_filter_pushdown( &self, @@ -179,12 +169,22 @@ impl TableSource for SqlTableSource { Ok(TableProviderFilterPushDown::Unsupported) } } +} + +/// Implement TableSource, used in the logical query plan and in logical query optimizations +impl TableSource for SqlTableSource { + fn as_any(&self) -> &dyn Any { + self + } + + fn schema(&self) -> SchemaRef { + self.schema.clone() + } fn table_type(&self) -> datafusion::logical_expr::TableType { datafusion::logical_expr::TableType::Base } - #[allow(deprecated)] fn supports_filters_pushdown( &self, filters: &[&Expr], @@ -195,7 +195,7 @@ impl TableSource for SqlTableSource { .collect() } - fn get_logical_plan(&self) -> Option<&datafusion::logical_expr::LogicalPlan> { + fn get_logical_plan(&self) -> Option> { None } }