jackwener commented on code in PR #4192:
URL: https://github.com/apache/arrow-datafusion/pull/4192#discussion_r1021125118
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1145,6 +1145,22 @@ impl Projection {
})
}
+ /// Create a new Projection using the specified output schema
+ pub fn new_from_schema(input: Arc<LogicalPlan>, schema: DFSchemaRef) ->
Self {
+ let expr: Vec<Expr> = schema
+ .fields()
+ .iter()
+ .map(|field| field.qualified_column())
+ .map(Expr::Column)
+ .collect();
+ Self {
+ expr,
+ input,
+ schema,
+ alias: None,
+ }
+ }
Review Comment:
```scala
spark Union
case class Union(
children: Seq[LogicalPlan],
byName: Boolean = false,
allowMissingCol: Boolean = false) extends LogicalPlan {
}
```
--
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]