liukun4515 commented on issue #3421:
URL:
https://github.com/apache/arrow-datafusion/issues/3421#issuecomment-1245045222
I find the code below:
```
/// returns all expressions (non-recursively) in the current
/// logical plan node. This does not include expressions in any
/// children
pub fn expressions(self: &LogicalPlan) -> Vec<Expr> {
match self {
LogicalPlan::Projection(Projection { expr, .. }) => expr.clone(),
LogicalPlan::Values(Values { values, .. }) => {
values.iter().flatten().cloned().collect()
}
LogicalPlan::Filter(Filter { predicate, .. }) =>
vec![predicate.clone()],
LogicalPlan::Repartition(Repartition {
partitioning_scheme,
..
}) => match partitioning_scheme {
Partitioning::Hash(expr, _) => expr.clone(),
Partitioning::DistributeBy(expr) => expr.clone(),
Partitioning::RoundRobinBatch(_) => vec![],
},
LogicalPlan::Window(Window { window_expr, .. }) =>
window_expr.clone(),
LogicalPlan::Aggregate(Aggregate {
group_expr,
aggr_expr,
..
}) =>
group_expr.iter().chain(aggr_expr.iter()).cloned().collect(),
LogicalPlan::Join(Join { on, filter, .. }) => on
.iter()
.flat_map(|(l, r)| vec![Expr::Column(l.clone()),
Expr::Column(r.clone())])
.chain(
filter
.as_ref()
.map(|expr| vec![expr.clone()])
.unwrap_or_default(),
)
.collect(),
LogicalPlan::Sort(Sort { expr, .. }) => expr.clone(),
LogicalPlan::Extension(extension) =>
extension.node.expressions(),
// plans without expressions
LogicalPlan::TableScan { .. }
```
The filter expr is not belong to the table scan
@Dandandan
--
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]