kosiew commented on code in PR #22783:
URL: https://github.com/apache/datafusion/pull/22783#discussion_r3367307461
##########
datafusion/expr/src/logical_plan/tree_node.rs:
##########
@@ -671,9 +671,40 @@ impl LogicalPlan {
_ => Transformed::no(stmt),
}
.update_data(LogicalPlan::Statement),
+ LogicalPlan::Unnest(Unnest {
+ input,
+ exec_columns,
+ list_type_columns,
+ struct_type_columns,
+ dependency_indices,
+ schema,
+ options,
+ }) => {
+ let exprs: Vec<Expr> =
+ exec_columns.into_iter().map(Expr::Column).collect();
+ exprs.map_elements(f)?.update_data(|mapped_exprs| {
+ let new_columns = mapped_exprs
+ .into_iter()
+ .map(|e| match e {
+ Expr::Column(c) => c,
+ _ => unreachable!(
+ "Unnest exec_columns must remain Column
expressions"
+ ),
+ })
+ .collect();
+ LogicalPlan::Unnest(Unnest {
Review Comment:
`map_expressions` can now update `Unnest.exec_columns`, but this branch
rebuilds `LogicalPlan::Unnest` by carrying over the old `list_type_columns`,
`struct_type_columns`, `dependency_indices`, and `schema`.
Those fields are derived from the selected input columns in
`Unnest::try_new`. So if a mapper changes `list_col` to a different column,
`expressions()` reports the new column, while planning and execution can still
use the stale indices and schema.
Could we rebuild this through
`unnest_with_options(Arc::unwrap_or_clone(input), new_columns, options)`, or a
shared helper, after validating `Expr::Column`? That would also keep this
aligned with `with_new_exprs`.
--
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]