ISSUE-3572 try fix stack overflow#3603
Conversation
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/databend/databend/8jMkZZ7y1JCYj8k5F5d3kW3JK5UL [Deployment for 4447d08 canceled] |
|
Need a test case to cover the issue. |
xudong963
left a comment
There was a problem hiding this comment.
I have tried to use maybe_grow() to solve stack overflow in another database, but it can't completely solve the problem, only to prevent panic or limit users' behavior. I think your idea can fully solve stack overflow, nice work!
| visitor = arg.accept(visitor)?; | ||
| fn visit(mut self, predecessor_expr: &Expression) -> Result<Self> { | ||
| let mut stack = vec![RecursionProcessing::Call(predecessor_expr)]; | ||
| while let Some(element) = stack.pop() { |
There was a problem hiding this comment.
If I read correctly, you try to avoid stack overflow by manually replacing the stack with the heap. You are essentially simulating a stack behavior. Maybe we can fully avoid recursing by using iterating? And VecDeque may be a good structure.
There was a problem hiding this comment.
Maybe we can fully avoid recursing by using iterating? And VecDeque may be a good structure.
We want to support both preorder traversal(pre_visit) and postorder traversal(post_visit), which makes me think of the stack first, maybe you have a better idea, please let me know. : D
|
This pull request has merge conflicts that must be resolved before it can be merged. @zhang2014 please rebase it 🙏 |
|
Need resolve the conflicts. |
Let's convert PR to draft first and I will continue to this work until it's ready. |
# Conflicts: # common/planners/src/plan_expression.rs # common/planners/src/plan_expression_chain.rs
Codecov Report
@@ Coverage Diff @@
## main #3603 +/- ##
======================================
Coverage 60% 60%
======================================
Files 697 705 +8
Lines 37230 37787 +557
======================================
+ Hits 22367 22709 +342
- Misses 14863 15078 +215
Continue to review full report at Codecov.
|
|
Wait for another reviewer approval |
|
CI Passed |
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
fix stack overflow.
Changelog
Related Issues
#3572 Partial fixes(SQL parser may still stack overflow)
Test Plan
Unit Tests
Stateless Tests