kmitchener commented on code in PR #3258:
URL: https://github.com/apache/arrow-datafusion/pull/3258#discussion_r956741498
##########
datafusion/core/src/datasource/view.rs:
##########
@@ -104,14 +107,24 @@ impl TableProvider for ViewTable {
)
})
.collect();
- let plan = LogicalPlanBuilder::from(self.logical_plan.clone())
- .project(fields)?
- .build()?;
- state_cloned.create_physical_plan(&plan).await
+ plan_builder.project(fields)?
}
} else {
- state_cloned.create_physical_plan(&self.logical_plan).await
- }
+ plan_builder
+ };
+
+ let plan = plan_builder
+ // add filters, otherwise use `true` as the predicate
+ .filter(
+ filters
+ .iter()
+ .fold(Expr::Literal(ScalarValue::Boolean(Some(true))),
|acc, f| {
+ acc.and(f.clone())
+ }),
+ )?
+ .limit(None, limit)?
Review Comment:
This should be wrapped in an if to determine if a limit was passed in to
scan(). If no limit, don't call plan_builder.limit(). The way this is written,
it's adding a Limit to the logical plan always.
something like
```rust
if limit.is_some() {
plan_builder.limit(None, limit)?;
}
```
--
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]