nathanb9 commented on code in PR #22783:
URL: https://github.com/apache/datafusion/pull/22783#discussion_r3369768754


##########
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:
   thanks, fixed. `map_expressions` now rebuilds via 
`unnest_with_options(Arc::unwrap_or_clone(input)`, new_columns, options) after 
validating the exprs are `Expr::Column`, so `list_type_columns`, 
`struct_type_columns`, `dependency_indices`, and schema are recomputed from the 
(possibly rewritten) columns instead of carried over stale. 
   This also keeps it 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]

Reply via email to