gstvg commented on PR #21323:
URL: https://github.com/apache/datafusion/pull/21323#issuecomment-4356513683

   @rluvaton This is ready for review. Note I kept the same approach because it 
fully implements capture and doesn't make copies of uncaptured columns, the 
whole tree is exposed via TreeNode and every Column exposed to regular tree 
traversals have an index referring to the outer schema, without requiring new 
tree node methods. It does so by implementing the same optimization as 
CaseWhen, collect used indices, rewrite the body into a projected_body but 
expose the unprojected body to TreeNode, and then project the batch before 
providing it to the function implementer via `LambdaArgument.captures`. But if 
using `ProjectionExpr` is better as you suggested before I'm open to it.
   
   Note I'm using the same approach as #18329 to keep the codebase consistent, 
but my first version before it got merged instead of rewriting+projecting, 
simply swapped uncaptured columns for NullArrays which are cheap to create. 
While not as elegant as #18329, it's simpler and easier to reason about 
specially in the context of deeply nested lambdas and case's. 
   
   cc @LiaCastaneda @comphead @pepijnve 


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