You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rewrite recursive procedures into iterative procedures, suggested by @houqp@alamb
This is an acceptable short term workaround, but I think it would be more efficient and more elegant if we rewrite these recursive procedures into iterative procedures.
Do you mean to use push-based model?
@xudong963 , I think what @houqp is suggesting is to rewrite code that is recursive to not be recursive.
The pattern for Datafusion probably looks like taking code like
fnvisit(expr:&expr){for child in expr.children(){visit(child)}// do actual expr logic}
And changing it so the state is tracked with a structure on the heap rather than a stack. I think VecDeque is a good one for rust:
fnvisit(expr:&expr){letmut worklist = VecDequeue::new();
worklist.push_back(expr);while !worklist.is_empty(){let parent = worklist.pop_front();for child in parent.children(){
worklist.push_back(child)}// do actual expr logic on parent}}
Rewrite recursive procedures into iterative procedures, suggested by @houqp @alamb
@xudong963 , I think what @houqp is suggesting is to rewrite code that is recursive to not be recursive.
The pattern for Datafusion probably looks like taking code like
And changing it so the state is tracked with a structure on the heap rather than a stack. I think
VecDeque
is a good one for rust:(aka avoid the call back to
visit
)Originally posted by @alamb in #1437 (comment)
The text was updated successfully, but these errors were encountered: