Skip to content

Semantics: is a var-object join over RDF list elements a bag join over positions or a set join over values? #1687

Open

Description

@bplatz

Status (2026-11-14)

#1746 (merged 2026-09-03) did the join-equivalence half. When the membership lane sees list rows, it routes every row through its exact per-row path, so above the gate it now returns the same rows as the generic join. it_membership_join_list_rows pins this with routing stamps, and FLUREE_DISABLE_QUERY_FAST_PATHS now reaches the lane.

Step 1, the semantics decision, is what remains: should a var-object join over list elements be a bag join over positions (today's answer, 5 in the example below) or a set join over distinct values (3)? Both fixtures pin today's numbers, so deciding the other way means changing those expectations on purpose. Changing the answer would change query results, so this is in the 5.0.0 milestone.


Original description

Raised in review of #1674.

Gap

it_fastpath_1652_regression's composite join, list rows case is the only coverage of what a var-object join answers over RDF list elements. After #1674 costs the membership lane against the planner's driving estimate, that fixture sits below MEMBERSHIP_JOIN_MIN_DRIVING, so the lane declines and the case only exercises the generic pipeline.

Nothing now pins what MembershipJoinOperator answers for this shape at or above the gate, and the two disagree:

  • generic join — bag join over list elements: s2's two q-1 entries pair 2×2 = 4, s3 pairs its shared r-1 once, s1 never matches → 5
  • membership lane — semi-join, one row per driving row → 3

That divergence was the original 1652 finding. #1674 removed the shape from the lane's reach rather than reconciling it, which is the right call for a regression fix but leaves the behaviour untested.

Why this is not just "add a fixture above the gate"

Whether list position is part of a literal's identity is an open semantics question — #1676 explicitly deferred it in its "Not in this PR" section. Adding a fixture now would pin one of the two answers as correct before that call is made, which is why #1674 only softened the existing comment rather than adding a case.

So this is really two steps:

  1. Settle whether a var-object join over list elements is a bag join (5) or a semi-join / set join (3) — the semantics decision deferred by fix: match string literals by RDF term identity; normalize language-tag case #1676.
  2. Once settled, add a fixture above MEMBERSHIP_JOIN_MIN_DRIVING pinning the lane to the same answer as the generic pipeline — and, if they are meant to agree, make the lane decline on list rows rather than return a different answer.

Origin

Review of #1674 (fix: two v4.1.6 planner regressions — star-join reorder and membership-join admission); semantics question deferred by #1676.

Activity

  1. added
    area:query
    P2
    triage:needs-decision
    on Aug 26, 2026
  2. aaj3f commented on Aug 26, 2026

    @aaj3f
    Contributor

    Ran this through the triage sweep's verification protocol (claude-assisted) — verified at a824bbfd1: the gate sits at where_plan.rs:2899/:2923, membership_join_key_vars (:2909-2970) has no list/o_i exclusion so the shape is admitted above 256 driving rows, and membership_join.rs is unchanged since 47e96b7b6, so its semi-join answer stands above the gate.

    Three things worth adding:

    The divergence is live-reproducible, not just unpinned. Same ledger, same query: 3 rows with MembershipJoinOperator in the EXPLAIN plan, vs 5 rows with the lane declined (forced by a small leading VALUES). Fixture and exact commands are in the sweep artifact if useful.

    I think the two-step sequencing can be relaxed. Step 2 as written ("if they're meant to agree, make the lane decline on list rows") doesn't actually depend on step 1 — the lane's own module docs assert join-equivalence unconditionally ("routes EVERY row through the exact per-row fallback ... so the lane is join-equivalent unconditionally"), and list rows break that invariant whichever way the semantics call lands. So making the lane decline (or take its per-row exact path) on list rows is an S-effort restoration of a property the lane already claims, and it can land before the semantics decision — which would then govern only what the generic pipeline should answer, and what the eventual above-gate fixture pins.

    One testability gap the fixing PR will hit: FLUREE_DISABLE_QUERY_FAST_PATHS doesn't reach this lane (verified — identical 3-row answer with it set) and membership_join.rs has no stamp_fast_path call, so MustFire/MustNotFire(PLAN_SITE) can't express lane engagement here. The EXPLAIN physical plan does render MembershipJoinOperator and works as the oracle, but adding a routing stamp to the lane seems like a small, generally useful alternative.

    Related and still open: #1686, the other deferral out of the same review — both trace to the same literal-identity seam.

  3. changed the title [-]Membership-join lane's answer on list rows is unpinned at or above the driving-size gate[/-] [+]Semantics: is a var-object join over RDF list elements a bag join over positions or a set join over values?[/+] on Nov 14, 2026
  4. added this to the 5.0.0 milestone on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:querytriage:needs-decision

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions