pabadrubio opened a new pull request, #22620:
URL: https://github.com/apache/datafusion/pull/22620

   ## Which issue does this PR close?
   
   Closes https://github.com/apache/datafusion/issues/22615.
   
   ## Rationale for this change
   
   `PushDownLeafProjections` throws an error when it tries to push down an 
expression through an `Unnest` node. It also tries to push leaf projections 
incorrectly for `Unnest` nodes.
   
   ## What changes are included in this PR?
   
   This PR makes PushDownLeafProjections never push down leaf expressions 
through Unnest nodes. This avoids the code in `try_push_into_inputs` from 
calling:
   ```
   let new_node = node.with_new_exprs(node.expressions(), new_inputs)?;
   ```
   on an Unnest node, which doesn't work.
   
   Changing that line is not enough, as even in that case the code in 
`try_push_into_inputs` to decide when to push down a projection is not valid 
for Unnest nodes, as explained in .... 
   
   In this PR, I only want to make sure that the optimizer works for Unnest 
cases, but we could probably do better and allow leaf expressions push downs 
when the expression refer to a column that is not being unnested.
   
   ## Are these changes tested?
   
   Added unit tests and `.slt` tests for these cases.
   
   ## Are there any user-facing changes?
   
   No


-- 
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