alamb commented on code in PR #17336:
URL: https://github.com/apache/datafusion/pull/17336#discussion_r2345346409
##########
datafusion/catalog/src/table.rs:
##########
@@ -171,6 +171,38 @@ pub trait TableProvider: Debug + Sync + Send {
limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>>;
+ /// Create an [`ExecutionPlan`] for scanning the table using structured
arguments.
+ ///
+ /// This method uses [`ScanArgs`] to pass scan parameters in a structured
way
+ /// and returns a [`ScanResult`] containing the execution plan. This
approach
+ /// allows for extensible parameter passing and result handling.
Review Comment:
x
```suggestion
/// and returns a [`ScanResult`] containing the execution plan.
```
##########
datafusion/catalog/src/table.rs:
##########
@@ -171,6 +171,38 @@ pub trait TableProvider: Debug + Sync + Send {
limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>>;
+ /// Create an [`ExecutionPlan`] for scanning the table using structured
arguments.
+ ///
+ /// This method uses [`ScanArgs`] to pass scan parameters in a structured
way
+ /// and returns a [`ScanResult`] containing the execution plan. This
approach
+ /// allows for extensible parameter passing and result handling.
+ ///
+ /// Table providers can override this method to take advantage of
additional
+ /// parameters like `preferred_ordering` that may not be available through
Review Comment:
```suggestion
/// parameters like the upcoming `preferred_ordering` that may not be
available through
```
##########
datafusion/core/src/datasource/listing/table.rs:
##########
@@ -1169,6 +1169,24 @@ impl TableProvider for ListingTable {
filters: &[Expr],
limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>> {
+ let options = ScanArgs::default()
+ .with_projection(projection.map(|p| p.as_slice()))
+ .with_filters(Some(filters))
+ .with_limit(limit);
+ Ok(Arc::clone(
+ self.scan_with_args(state, options).await?.plan(),
+ ))
Review Comment:
```suggestion
Ok(self.scan_with_args(state, options).await?.into_inner())
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]