Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PZ Optimizer Loops Forever if ApplyRule Fails for Implementing Physical Operator #130

Open
mdr223 opened this issue Feb 18, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mdr223
Copy link
Collaborator

mdr223 commented Feb 18, 2025

During the execution of Optimizer.search_optimization_space(), when the plan is first getting scored, every task to OptimizePhysicalExpression will create two new tasks:

  1. An OptimizeGroup for the input_group_id(s)
  2. An OptimizePhysicalExpression to re-optimize this physical expression once the input group is optimized

The OptimizeGroup is added to the end of the new_tasks so that it will execute first, before the task to re-optimize the physical expression.

If the OptimizeGroup task fails -- or more precisely, if any task in the sub-tree of tasks which optimize that group fails -- then the optimizer will loop forever, because the call to optimize the physical expression will re-create tasks (1.) and (2.) above, and the cycle repeats forever.

We can catch this behavior by checking to see if the OptimizePhysicalExpression is being invoked for a 2nd time without the input group having been costed. If we detect this -- we should throw an exception (rather than looping forever)

@mdr223 mdr223 added the bug Something isn't working label Feb 18, 2025
@mdr223 mdr223 self-assigned this Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant