FA-44971 / Data systems / Open access
Merge join matches only the first row of a repeated left key · case 01
Merge join matches only the first row of a repeated left key.
ROOT CAUSE
merge-join-runs: Merge join matches only the first row of a repeated left key.
THE FAILURE
merge-join-runs: Merge join matches only the first row of a repeated left key.
Unsuccessful approach: Comparing whole rows rather than keys breaks runs with distinct row IDs.
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 False: ie+=1
je=j+1
while je<len(right) and right[je][0]==b: 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], [10, 21]] | [[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 / e7d52b8960ddc5287a8a502467052d16d33a897445d7bf76bf4414f7682b72bf
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]==left[i]: ie+=1
je=j+1
while je<len(right) and right[je][0]==b: 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], [10, 21]] | [[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 / 40baefbf430043d14347a3d1c6fc0f673bcf3c81ed3742c132de0412e00bca1f
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 / 3ed7a188107de8ad533ffcae93680284386e587b53d1fe74d07f16db762f3815