Skip to content

Commit

Permalink
update impl TableSource for SqlTableSource
Browse files Browse the repository at this point in the history
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<Cow<_>> upstream. [2]

Refs
[1]: apache/datafusion#12239
[2]: apache/datafusion#12113
  • Loading branch information
Michael-J-Ward committed Sep 10, 2024
1 parent 9afae08 commit 0eaf193
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/common/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -151,17 +152,6 @@ impl SqlTableSource {
pub fn filepaths(&self) -> Option<&Vec<String>> {
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,
Expand All @@ -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],
Expand All @@ -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<Cow<datafusion::logical_expr::LogicalPlan>> {
None
}
}
Expand Down

0 comments on commit 0eaf193

Please sign in to comment.