-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve docs for TableProvider::supports_filters_pushdown
and remove deprecated function
#9923
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,10 @@ pub trait TableProvider: Sync + Send { | |
/// which *all* of the `Expr`s evaluate to `true` must be returned (aka the | ||
/// expressions are `AND`ed together). | ||
/// | ||
/// To enable filter pushdown you must override of | ||
alamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// [`Self::supports_filters_pushdown`] as the default implementation does | ||
/// not and `filters` will be empty. | ||
/// | ||
/// DataFusion pushes filtering into the scans whenever possible | ||
/// ("Filter Pushdown"), and depending on the format and the | ||
/// implementation of the format, evaluating the predicate during the scan | ||
|
@@ -154,28 +158,31 @@ pub trait TableProvider: Sync + Send { | |
limit: Option<usize>, | ||
) -> Result<Arc<dyn ExecutionPlan>>; | ||
|
||
/// 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")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has been deprecated for quite a while |
||
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. | ||
/// Note: the returned vector much have the same size as the filters argument. | ||
#[allow(deprecated)] | ||
/// Specify if DataFusion should provide filter expressions to the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to improve the docs about what this was doing |
||
/// TableProvider to apply *during* the scan. | ||
/// | ||
/// The return value must have one element for each filter expression passed | ||
/// in. The value of each element indicates if the TableProvider can apply | ||
/// that particular filter during the scan. | ||
/// | ||
/// Some TableProviders can evaluate filters more efficiently than the | ||
/// `Filter` operator in DataFusion, for example by using an index. | ||
alamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/// | ||
/// By default, returns [`Unsupported`] for all filters, meaning no filters | ||
/// will be provided to [`Self::scan`]. If the TableProvider can implement | ||
/// filter pushdown, it should return either [`Exact`] or [`Inexact`]. | ||
/// | ||
/// [`Unsupported`]: TableProviderFilterPushDown::Unsupported | ||
/// [`Exact`]: TableProviderFilterPushDown::Exact | ||
/// [`Inexact`]: TableProviderFilterPushDown::Inexact | ||
fn supports_filters_pushdown( | ||
&self, | ||
filters: &[&Expr], | ||
) -> Result<Vec<TableProviderFilterPushDown>> { | ||
filters | ||
.iter() | ||
.map(|f| self.supports_filter_pushdown(f)) | ||
.collect() | ||
Ok(vec![ | ||
TableProviderFilterPushDown::Unsupported; | ||
filters.len() | ||
]) | ||
} | ||
|
||
/// Get statistics for this table, if available | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switches to using the non deprecated but very similarly named API