cisaacson commented on code in PR #9988:
URL: https://github.com/apache/arrow-datafusion/pull/9988#discussion_r1558714781


##########
datafusion/core/src/datasource/provider.rs:
##########
@@ -161,20 +161,73 @@ pub trait TableProvider: Sync + Send {
     /// Specify if DataFusion should provide filter expressions to the
     /// TableProvider to apply *during* the scan.
     ///
+    /// Some TableProviders can evaluate filters more efficiently than the
+    /// `Filter` operator in DataFusion, for example by using an index.
+    /// 
     /// 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.
+    /// that particular filter during the scan. The position in the return 
value
+    /// Vec corresponds to the expression in the `filters` input. 
+    /// 
+    /// Here is an example of how this can be done:
+    /// 
+    /// ```rust
+    /// use datafusion::error::{Result, DataFusionError};
+    /// use datafusion_expr::{Expr, TableProviderFilterPushDown};
+    /// 
+    /// // Override the supports_filters_pushdown to evaluate which 
expressions 
+    /// // to accept as pushdown predicates.
+    /// fn supports_filters_pushdown(&self, filters: &[&Expr]) -> 
Result<Vec<TableProviderFilterPushDown>> {

Review Comment:
   Thanks @andygrove , all good catches.
   
   To add the `impl` it would be for `TableProvider` so do I need to create an 
entire struct, etc. to do that? Any help on how to contribute a minimal doc 
example would be great. I use VS Code with Rust Analyzer, I also do not see an 
easy way to copy code into the doc and make it a fn doc comment.
   
   Any help appreciated, then I'll get it cleaned up. I see other areas I can 
help with the docs too once I have a fully verified example.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to