pepijnve commented on issue #21231: URL: https://github.com/apache/datafusion/issues/21231#issuecomment-4350321900
Sorry, I didn't provide enough context. I scribbled up my current understanding so I have something to point to. <img width="3471" height="4275" alt="Image" src="https://github.com/user-attachments/assets/6dc49d3d-1bb7-4cf4-b539-ac6336c7204f" /> I'm using high-order function calls here as an example, but I think this can be generalised to other things as well. If I understood it correctly, the problem we want to handle is the fact that the lambda function in this diagram will use a local schema that is different from the outer schema. The outer one is `a@0, b@1, c@2` while the lambda one is `el@0, c@1`. My assumption is that somewhere at some point in the code there has to be logic that implements the mapping of the outer `c@2` to the inner `c@1`. In my sketch, my assumption is that that's the 'apply higher order function' node and that is has a mapping table with an entry `2 -> 1`. A recursive 'collect column indices' function should be able to handle this provided that each node can process the answer from its children. The high-order function application expression node needs to know which of its children are plain expressions, which are functions, what the indices for the lambda variables are, etc. so I would expect it to be able to handle the mapping of the `[0, 1]` answer from the function expression to `[2]` for the outer scope. As I wrote this, I think I've answered my own question. This is probably easiest to implement with internal recursion (i.e. the trait method provides the answer for the target expression itself and all its children). The alternative would require an extra method to handle the remapping. The other questions I had were more coding style questions regarding how you express output parameters in Rust: literally a `mut` output parameter, a callback, something else? The more important question though is if the model sketched above is a sufficient solution? Am I overlooking something? -- 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]
