Skip to content

Fix handling of node numbers in queries with multiple alternatives#338

Open
matthias-stemmler wants to merge 1 commit into
korpling:mainfrom
matthias-stemmler:bugfix/node-numbers-multiple-alternatives
Open

Fix handling of node numbers in queries with multiple alternatives#338
matthias-stemmler wants to merge 1 commit into
korpling:mainfrom
matthias-stemmler:bugfix/node-numbers-multiple-alternatives

Conversation

@matthias-stemmler

Copy link
Copy Markdown
Contributor

I stumbled upon a bug in the way node numbers are counted in queries with multiple alternatives: In some cases indices local to the current conjunction are compared against global indices. I first noticed it when an unbound variable occurs in an alternative other than the first one. When searching through the module, I found two more instances of this issue.

For the fix, I subtract self.var_idx_offset to convert global to local indices. I turned get_cost_estimates and should_switch_operand_order into methods so they have access to this offset.

@thomaskrause thomaskrause self-assigned this Jun 22, 2026
@thomaskrause

Copy link
Copy Markdown
Member

Thanks for reporting and fixing this! We had quite a lot of fixes in the handling of the nodes in alternatives, because we keep hitting edges cases. When reviewing this PR, I will also check the existing mechanism for this because it might be exceptionally problematic and I want to check if the mental model of it is sufficient.

Thus it will probable take some time to review it (semester time is quite busy with teaching and meetings right now) but not because of the changes but because of the context. I will keep you updated about the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants