FAILURE MAP
← Case archive

FA-44836 / Data systems / Open access

Scalar lookup joins absent keys to absent keys · case 01

Scalar lookup joins absent keys to absent keys.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

scalar-subquery-cardinality: Scalar lookup joins absent keys to absent keys.

THE FAILURE

scalar-subquery-cardinality: Scalar lookup joins absent keys to absent keys.

Unsuccessful approach: Null as wildcard is not ordinary correlation equality.

Case contract

Evaluate a correlated scalar lookup per outer key. Zero rows yield None, exactly one row yields its value including None, and two or more matching rows yield the explicit value CARDINALITY. Count physical rows, not distinct or non-null values.

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:
        keys,inner=d
        out=[]
        for key in keys:
            matches=[value for k,value in inner if k==key]
            count=len(matches)
            if count==0: value=None
            elif count==1: value=matches[0]
            else: value='CARDINALITY'
            out.append(value)
        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 physical rows', solve([['a'], [['a', 1], ['a', 1]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 1]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 1], ['b', 2]]]), [1, 2])
    check('null correlation', solve([[None], [[None, 1]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 1], ['a', 2]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 1], [None, 2]]]), [1])
    check('no outer rows', solve([[], [['a', 1]]]), [])
elif N == 2:
    check('duplicate physical rows', solve([['a'], [['a', 2], ['a', 2]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 2]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 2], ['b', 3]]]), [2, 3])
    check('null correlation', solve([[None], [[None, 2]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 2], ['a', 3]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 2], [None, 3]]]), [2])
    check('no outer rows', solve([[], [['a', 2]]]), [])
elif N == 3:
    check('duplicate physical rows', solve([['a'], [['a', 3], ['a', 3]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 3]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 3], ['b', 4]]]), [3, 4])
    check('null correlation', solve([[None], [[None, 3]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 3], ['a', 4]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 3], [None, 4]]]), [3])
    check('no outer rows', solve([[], [['a', 3]]]), [])
elif N == 4:
    check('duplicate physical rows', solve([['a'], [['a', 4], ['a', 4]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 4]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 4], ['b', 5]]]), [4, 5])
    check('null correlation', solve([[None], [[None, 4]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 4], ['a', 5]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 4], [None, 5]]]), [4])
    check('no outer rows', solve([[], [['a', 4]]]), [])
elif N == 5:
    check('duplicate physical rows', solve([['a'], [['a', 5], ['a', 5]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 5]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 5], ['b', 6]]]), [5, 6])
    check('null correlation', solve([[None], [[None, 5]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 5], ['a', 6]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 5], [None, 6]]]), [5])
    check('no outer rows', solve([[], [['a', 5]]]), [])
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 fixtureActualExpectedOutcome
duplicate physical rows['CARDINALITY']['CARDINALITY']Passed
one null and one value['CARDINALITY']['CARDINALITY']Passed
unrelated keys[1, 2][1, 2]Passed
null correlation[1][None]Failed
empty lookup[None][None]Passed
single null[None][None]Passed
two values['CARDINALITY']['CARDINALITY']Passed
null row cannot correlate[1][1]Passed
no outer rows[][]Passed

SHA-256 / 2ee80323073dcfea9f3855b148405255245cad125717077514e73556a7fba0d9

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        keys,inner=d
        out=[]
        for key in keys:
            matches=[value for k,value in inner if key is None or k==key]
            count=len(matches)
            if count==0: value=None
            elif count==1: value=matches[0]
            else: value='CARDINALITY'
            out.append(value)
        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 physical rows', solve([['a'], [['a', 1], ['a', 1]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 1]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 1], ['b', 2]]]), [1, 2])
    check('null correlation', solve([[None], [[None, 1]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 1], ['a', 2]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 1], [None, 2]]]), [1])
    check('no outer rows', solve([[], [['a', 1]]]), [])
elif N == 2:
    check('duplicate physical rows', solve([['a'], [['a', 2], ['a', 2]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 2]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 2], ['b', 3]]]), [2, 3])
    check('null correlation', solve([[None], [[None, 2]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 2], ['a', 3]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 2], [None, 3]]]), [2])
    check('no outer rows', solve([[], [['a', 2]]]), [])
elif N == 3:
    check('duplicate physical rows', solve([['a'], [['a', 3], ['a', 3]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 3]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 3], ['b', 4]]]), [3, 4])
    check('null correlation', solve([[None], [[None, 3]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 3], ['a', 4]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 3], [None, 4]]]), [3])
    check('no outer rows', solve([[], [['a', 3]]]), [])
elif N == 4:
    check('duplicate physical rows', solve([['a'], [['a', 4], ['a', 4]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 4]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 4], ['b', 5]]]), [4, 5])
    check('null correlation', solve([[None], [[None, 4]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 4], ['a', 5]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 4], [None, 5]]]), [4])
    check('no outer rows', solve([[], [['a', 4]]]), [])
elif N == 5:
    check('duplicate physical rows', solve([['a'], [['a', 5], ['a', 5]]]), ['CARDINALITY'])
    check('one null and one value', solve([['a'], [['a', None], ['a', 5]]]), ['CARDINALITY'])
    check('unrelated keys', solve([['a', 'b'], [['a', 5], ['b', 6]]]), [5, 6])
    check('null correlation', solve([[None], [[None, 5]]]), [None])
    check('empty lookup', solve([['a'], []]), [None])
    check('single null', solve([['a'], [['a', None]]]), [None])
    check('two values', solve([['a'], [['a', 5], ['a', 6]]]), ['CARDINALITY'])
    check('null row cannot correlate', solve([['a'], [['a', 5], [None, 6]]]), [5])
    check('no outer rows', solve([[], [['a', 5]]]), [])
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 fixtureActualExpectedOutcome
duplicate physical rows['CARDINALITY']['CARDINALITY']Passed
one null and one value['CARDINALITY']['CARDINALITY']Passed
unrelated keys[1, 2][1, 2]Passed
null correlation[1][None]Failed
empty lookup[None][None]Passed
single null[None][None]Passed
two values['CARDINALITY']['CARDINALITY']Passed
null row cannot correlate[1][1]Passed
no outer rows[][]Passed

SHA-256 / a31ed55d58af145f1a1a049002ec928836fd0aed83816a871c48cffe206996df

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 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:16.263733+00:00.

Case digest / 44091978fbe12b9381312579556b614395ba23882c1d6907e720f9ced9ac091c