alamb commented on code in PR #9690:
URL: https://github.com/apache/arrow-datafusion/pull/9690#discussion_r1535986457
##########
datafusion/optimizer/src/optimize_projections.rs:
##########
@@ -162,14 +163,37 @@ fn optimize_projections(
.map(|input|
((0..input.schema().fields().len()).collect_vec(), false))
.collect::<Vec<_>>()
}
+ LogicalPlan::Extension(extension) => {
+ let children = extension.node.inputs();
+ if children.len() != 1 {
+ // TODO: Add support for `LogicalPlan::Extension` with multi
children.
+ return Ok(None);
+ }
+ // has single child
+ let exprs = plan.expressions();
+ let child = children[0];
+ let node_schema = extension.node.schema();
+ let child_schema = child.schema();
+ if let Some(parent_required_indices_mapped) =
Review Comment:
> Which would produce following invalid plan:
That is a good point.
> What about an API something like
That is a great idea, though I don't fully understand why it uses `Expr`s
How about a slight refinement in terms of input/output columns:
```rust
/// Returns the necessary input columns to this node required to compute
/// the columns in the output schema
///
/// This is used for projection pushdown when DataFusion has determined that
/// only a subset of the output columns of this node are needed by its
parents.
/// This API is used to tell DataFusion which, if any, of the input columns
are no longer
/// needed.
///
/// Return `Ok(None)`, the default, if this information can not be determined
/// Returns `Ok(input_columns)` with the column indexes from this nodes'
input that are
/// needed to compute `output_columns`)
fn necessary_children_exprs(&self, output_columns: &[usize]) ->
Option<Vec<usize>> {
Ok(None)
}
```
🤔
--
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]