FA-44976 / Data systems / Open access
Merge join matches only the first row of a repeated right key · case 01
Merge join matches only the first row of a repeated right key.
ROOT CAUSE
merge-join-runs: Merge join matches only the first row of a repeated right key.
THE FAILURE
merge-join-runs: Merge join matches only the first row of a repeated right key.
Unsuccessful approach: Whole-row equality does not define equal-key runs.
Case contract
Join two key-sorted non-null relations [key,id] by matching equal-key runs. Emit the full left-major Cartesian product for each matching run. Advance the lower unmatched run and preserve physical order within equal-key runs.
Why this case matters
A bounded deterministic data engine model makes representation and changelog faults reproducible.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
left,right=d
i=j=0; out=[]
while i<len(left) and j<len(right):
a=left[i][0]; b=right[j][0]
if a<b: i+=1; continue
if a>b: j+=1; continue
ie=i+1
while ie<len(left) and left[ie][0]==a: ie+=1
je=j+1
while False: je+=1
for x in left[i:ie]:
for y in right[j:je]: out.append([x[1],y[1]])
i,j=ie,je
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('duplicate runs', solve([[[1, 10], [1, 11]], [[1, 20], [1, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[1, 10], [2, 11]], [[2, 20]]]), [[11, 20]])
check('right gap', solve([[[2, 10]], [[1, 20], [2, 21]]]), [[10, 21]])
check('single match', solve([[[1, 10]], [[1, 20]]]), [[10, 20]])
check('no overlap', solve([[[1, 10]], [[3, 20]]]), [])
check('empty left', solve([[], [[1, 20]]]), [])
check('empty right', solve([[[1, 10]], []]), [])
elif N == 2:
check('duplicate runs', solve([[[2, 10], [2, 11]], [[2, 20], [2, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[2, 10], [3, 11]], [[3, 20]]]), [[11, 20]])
check('right gap', solve([[[3, 10]], [[2, 20], [3, 21]]]), [[10, 21]])
check('single match', solve([[[2, 10]], [[2, 20]]]), [[10, 20]])
check('no overlap', solve([[[2, 10]], [[4, 20]]]), [])
check('empty left', solve([[], [[2, 20]]]), [])
check('empty right', solve([[[2, 10]], []]), [])
elif N == 3:
check('duplicate runs', solve([[[3, 10], [3, 11]], [[3, 20], [3, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[3, 10], [4, 11]], [[4, 20]]]), [[11, 20]])
check('right gap', solve([[[4, 10]], [[3, 20], [4, 21]]]), [[10, 21]])
check('single match', solve([[[3, 10]], [[3, 20]]]), [[10, 20]])
check('no overlap', solve([[[3, 10]], [[5, 20]]]), [])
check('empty left', solve([[], [[3, 20]]]), [])
check('empty right', solve([[[3, 10]], []]), [])
elif N == 4:
check('duplicate runs', solve([[[4, 10], [4, 11]], [[4, 20], [4, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[4, 10], [5, 11]], [[5, 20]]]), [[11, 20]])
check('right gap', solve([[[5, 10]], [[4, 20], [5, 21]]]), [[10, 21]])
check('single match', solve([[[4, 10]], [[4, 20]]]), [[10, 20]])
check('no overlap', solve([[[4, 10]], [[6, 20]]]), [])
check('empty left', solve([[], [[4, 20]]]), [])
check('empty right', solve([[[4, 10]], []]), [])
elif N == 5:
check('duplicate runs', solve([[[5, 10], [5, 11]], [[5, 20], [5, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[5, 10], [6, 11]], [[6, 20]]]), [[11, 20]])
check('right gap', solve([[[6, 10]], [[5, 20], [6, 21]]]), [[10, 21]])
check('single match', solve([[[5, 10]], [[5, 20]]]), [[10, 20]])
check('no overlap', solve([[[5, 10]], [[7, 20]]]), [])
check('empty left', solve([[], [[5, 20]]]), [])
check('empty right', solve([[[5, 10]], []]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| duplicate runs | [[10, 20], [11, 20]] | [[10, 20], [10, 21], [11, 20], [11, 21]] | Failed |
| left gap | [[11, 20]] | [[11, 20]] | Passed |
| right gap | [[10, 21]] | [[10, 21]] | Passed |
| single match | [[10, 20]] | [[10, 20]] | Passed |
| no overlap | [] | [] | Passed |
| empty left | [] | [] | Passed |
| empty right | [] | [] | Passed |
SHA-256 / b11e2d11dc84838081d4df0a687e9d906f51a50548b24655498c966214082ae7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
left,right=d
i=j=0; out=[]
while i<len(left) and j<len(right):
a=left[i][0]; b=right[j][0]
if a<b: i+=1; continue
if a>b: j+=1; continue
ie=i+1
while ie<len(left) and left[ie][0]==a: ie+=1
je=j+1
while je<len(right) and right[je]==right[j]: je+=1
for x in left[i:ie]:
for y in right[j:je]: out.append([x[1],y[1]])
i,j=ie,je
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('duplicate runs', solve([[[1, 10], [1, 11]], [[1, 20], [1, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[1, 10], [2, 11]], [[2, 20]]]), [[11, 20]])
check('right gap', solve([[[2, 10]], [[1, 20], [2, 21]]]), [[10, 21]])
check('single match', solve([[[1, 10]], [[1, 20]]]), [[10, 20]])
check('no overlap', solve([[[1, 10]], [[3, 20]]]), [])
check('empty left', solve([[], [[1, 20]]]), [])
check('empty right', solve([[[1, 10]], []]), [])
elif N == 2:
check('duplicate runs', solve([[[2, 10], [2, 11]], [[2, 20], [2, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[2, 10], [3, 11]], [[3, 20]]]), [[11, 20]])
check('right gap', solve([[[3, 10]], [[2, 20], [3, 21]]]), [[10, 21]])
check('single match', solve([[[2, 10]], [[2, 20]]]), [[10, 20]])
check('no overlap', solve([[[2, 10]], [[4, 20]]]), [])
check('empty left', solve([[], [[2, 20]]]), [])
check('empty right', solve([[[2, 10]], []]), [])
elif N == 3:
check('duplicate runs', solve([[[3, 10], [3, 11]], [[3, 20], [3, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[3, 10], [4, 11]], [[4, 20]]]), [[11, 20]])
check('right gap', solve([[[4, 10]], [[3, 20], [4, 21]]]), [[10, 21]])
check('single match', solve([[[3, 10]], [[3, 20]]]), [[10, 20]])
check('no overlap', solve([[[3, 10]], [[5, 20]]]), [])
check('empty left', solve([[], [[3, 20]]]), [])
check('empty right', solve([[[3, 10]], []]), [])
elif N == 4:
check('duplicate runs', solve([[[4, 10], [4, 11]], [[4, 20], [4, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[4, 10], [5, 11]], [[5, 20]]]), [[11, 20]])
check('right gap', solve([[[5, 10]], [[4, 20], [5, 21]]]), [[10, 21]])
check('single match', solve([[[4, 10]], [[4, 20]]]), [[10, 20]])
check('no overlap', solve([[[4, 10]], [[6, 20]]]), [])
check('empty left', solve([[], [[4, 20]]]), [])
check('empty right', solve([[[4, 10]], []]), [])
elif N == 5:
check('duplicate runs', solve([[[5, 10], [5, 11]], [[5, 20], [5, 21]]]), [[10, 20], [10, 21], [11, 20], [11, 21]])
check('left gap', solve([[[5, 10], [6, 11]], [[6, 20]]]), [[11, 20]])
check('right gap', solve([[[6, 10]], [[5, 20], [6, 21]]]), [[10, 21]])
check('single match', solve([[[5, 10]], [[5, 20]]]), [[10, 20]])
check('no overlap', solve([[[5, 10]], [[7, 20]]]), [])
check('empty left', solve([[], [[5, 20]]]), [])
check('empty right', solve([[[5, 10]], []]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| duplicate runs | [[10, 20], [11, 20]] | [[10, 20], [10, 21], [11, 20], [11, 21]] | Failed |
| left gap | [[11, 20]] | [[11, 20]] | Passed |
| right gap | [[10, 21]] | [[10, 21]] | Passed |
| single match | [[10, 20]] | [[10, 20]] | Passed |
| no overlap | [] | [] | Passed |
| empty left | [] | [] | Passed |
| empty right | [] | [] | Passed |
SHA-256 / b22c67c858c9f8241264743e74cfa15221bd745f3a7ce5747cc121690ee1c3a2
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:44:17.685378+00:00.
Case digest / 381751450269ce37ac8c7dc5014497fc29f28373d518deaa4e9a3ea4218ab8f8