Tim-53 opened a new pull request, #26758:
URL: https://github.com/apache/datafusion/pull/26758

   ## Which issue does this PR close?
   
   - Closes #26737.
   
   ## Rationale for this change
   
   Deserializing a logical plan from protobuf recurses once per nesting level, 
through `LogicalPlanNode::try_into_logical_plan`. Serialization already has a 
`recursive` stack-growth checkpoint (#23823 / #24124), but deserialization did 
not. In debug builds, where this function has a very large stack frame, a 
deeply nested plan could abort the process with a native stack overflow, even 
with `recursive_protection` enabled.
   
   ## What changes are included in this PR?
   
   Adds `#[cfg_attr(feature = "recursive_protection", recursive::recursive)]` 
to `try_into_logical_plan`. Every plan-to-plan recursion goes through this 
function.
   
   ## What is the testing strategy for this PR?
   
   Adds `deeply_nested_logical_plan_deserialization_uses_a_growable_stack` to 
`datafusion/proto/tests/cases/stack_safety.rs`. It converts a plan with 2,000 
nested `SubqueryAlias` nodes to proto and back on a 2 MiB thread stack.
   
   ## Are there any user-facing changes?
   
   No API changes. With `recursive_protection` enabled, deeply nested logical 
plans now deserialize instead of overflowing the stack.
   
   ---
   
   This PR was prepared with AI assistance and reviewed by the author.


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