Repository navigation
fix(or): join an or sharing no variable with earlier clauses as a cross product (#610) - #612
Merged
Merged
Conversation
…ss product (#610) apply_or_clauses' fast path replaced the incoming rows with the branch union when the two shared no user-visible variable, assuming the incoming rows were the empty start row. After any earlier clause that binds other variables, the rows lost those variables and projection dropped them, so the query returned nothing. The general hash join already handles this: with no shared variable every key is empty and each incoming row joins every branch row. The special case is removed. or-join keeps refusing unbound join variables (INT-018); it filters, it does not bind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #610.
Problem
[?x :edge ?z] (or [?p :edge :b] [?p :edge :c])returned no rows. Inapply_or_clauses, the fast path (nonot/not-join/pseudo-attribute in any branch) replaced the incoming rows with the branch union when they shared no user-visible variable. It assumed the incoming rows were the empty start row. After an earlier clause binding other variables,?xwas lost and projection dropped every row. The seeded path (a branch withnot) was already correct.Fix
The special case is removed. With no shared variable the general hash join's key is empty, so each incoming row joins every branch row, giving the cross product. When the incoming row is the empty start row, the result is the same as before. The fix covers queries and rule bodies, since both go through
apply_or_clauses.or-joinkeeps refusing a join variable that no earlier clause binds (INT-018). In Minigrafor-joinfilters on variables already bound and does not add new ones, so the refusal matches its semantics.orbinds its branch variables, so it must evaluate this shape.Tests
Six new tests in
tests/disjunction_test.rscover:orplaced after the other clauses and before themorin a rule bodyFour of them failed before the fix. Full suite: 1,544 passing, 10 ignored.
cargo clippy --all-features -D warningsis clean.Backport to
main(v2.0.x) to follow, under the "all bug fixes until v3.0.0" policy.🤖 Generated with Claude Code
https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR