FAILURE MAP
← Case archive

FA-44886 / Data systems / Open access

Pivot drops identities seen only in unrequested categories · case 01

Pivot drops identities seen only in unrequested categories.

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

ROOT CAUSE

categorical-pivot-lists: Pivot drops identities seen only in unrequested categories.

THE FAILURE

categorical-pivot-lists: Pivot drops identities seen only in unrequested categories.

Unsuccessful approach: Choosing one category as the row domain loses other identities.

Case contract

Pivot [row-id,category,value] into [row-id,list-for-category...] using the caller category order. Each cell is an ordered bag list. Unknown categories do not populate cells but retain their row identity; absent cells are empty lists and null values remain elements.

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:
        rows,categories=d
        ids=list(dict.fromkeys(i for i,c,v in rows if c in categories))
        out=[]
        for ident in ids:
            record=[ident]
            for category in categories:
                cell=[value for i,c,value in rows if i==ident and c==category]
                record.append(cell)
            out.append(record)
        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('column order', solve([[[1, 'a', 1], [1, 'b', 2]], ['b', 'a']]), [[1, [2], [1]]])
    check('unknown-only row', solve([[[1, 'z', 1]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 1], [2, 'a', 2]], ['a']]), [[1, [1]], [2, [2]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 1], [1, 'a', 1]], ['a']]), [[1, [1, 1]]])
    check('no categories', solve([[[1, 'a', 1]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 2:
    check('column order', solve([[[1, 'a', 2], [1, 'b', 3]], ['b', 'a']]), [[1, [3], [2]]])
    check('unknown-only row', solve([[[1, 'z', 2]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 2], [2, 'a', 3]], ['a']]), [[1, [2]], [2, [3]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 2], [1, 'a', 2]], ['a']]), [[1, [2, 2]]])
    check('no categories', solve([[[1, 'a', 2]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 3:
    check('column order', solve([[[1, 'a', 3], [1, 'b', 4]], ['b', 'a']]), [[1, [4], [3]]])
    check('unknown-only row', solve([[[1, 'z', 3]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 3], [2, 'a', 4]], ['a']]), [[1, [3]], [2, [4]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 3], [1, 'a', 3]], ['a']]), [[1, [3, 3]]])
    check('no categories', solve([[[1, 'a', 3]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 4:
    check('column order', solve([[[1, 'a', 4], [1, 'b', 5]], ['b', 'a']]), [[1, [5], [4]]])
    check('unknown-only row', solve([[[1, 'z', 4]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 4], [2, 'a', 5]], ['a']]), [[1, [4]], [2, [5]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 4], [1, 'a', 4]], ['a']]), [[1, [4, 4]]])
    check('no categories', solve([[[1, 'a', 4]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 5:
    check('column order', solve([[[1, 'a', 5], [1, 'b', 6]], ['b', 'a']]), [[1, [6], [5]]])
    check('unknown-only row', solve([[[1, 'z', 5]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 5], [2, 'a', 6]], ['a']]), [[1, [5]], [2, [6]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 5], [1, 'a', 5]], ['a']]), [[1, [5, 5]]])
    check('no categories', solve([[[1, 'a', 5]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
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
column order[[1, [2], [1]]][[1, [2], [1]]]Passed
unknown-only row[][[1, []]]Failed
two row groups[[1, [1]], [2, [2]]][[1, [1]], [2, [2]]]Passed
null fact[[1, [None]]][[1, [None]]]Passed
duplicate fact[[1, [1, 1]]][[1, [1, 1]]]Passed
no categories[][[1]]Failed
no facts[][]Passed

SHA-256 / 0479a3b13bb6d13d48bae8d43dfde6fff86f90b799a59da854df83702418adf9

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    try:
        rows,categories=d
        ids=list(dict.fromkeys(i for i,c,v in rows if c==categories[0])) if categories else []
        out=[]
        for ident in ids:
            record=[ident]
            for category in categories:
                cell=[value for i,c,value in rows if i==ident and c==category]
                record.append(cell)
            out.append(record)
        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('column order', solve([[[1, 'a', 1], [1, 'b', 2]], ['b', 'a']]), [[1, [2], [1]]])
    check('unknown-only row', solve([[[1, 'z', 1]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 1], [2, 'a', 2]], ['a']]), [[1, [1]], [2, [2]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 1], [1, 'a', 1]], ['a']]), [[1, [1, 1]]])
    check('no categories', solve([[[1, 'a', 1]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 2:
    check('column order', solve([[[1, 'a', 2], [1, 'b', 3]], ['b', 'a']]), [[1, [3], [2]]])
    check('unknown-only row', solve([[[1, 'z', 2]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 2], [2, 'a', 3]], ['a']]), [[1, [2]], [2, [3]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 2], [1, 'a', 2]], ['a']]), [[1, [2, 2]]])
    check('no categories', solve([[[1, 'a', 2]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 3:
    check('column order', solve([[[1, 'a', 3], [1, 'b', 4]], ['b', 'a']]), [[1, [4], [3]]])
    check('unknown-only row', solve([[[1, 'z', 3]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 3], [2, 'a', 4]], ['a']]), [[1, [3]], [2, [4]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 3], [1, 'a', 3]], ['a']]), [[1, [3, 3]]])
    check('no categories', solve([[[1, 'a', 3]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 4:
    check('column order', solve([[[1, 'a', 4], [1, 'b', 5]], ['b', 'a']]), [[1, [5], [4]]])
    check('unknown-only row', solve([[[1, 'z', 4]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 4], [2, 'a', 5]], ['a']]), [[1, [4]], [2, [5]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 4], [1, 'a', 4]], ['a']]), [[1, [4, 4]]])
    check('no categories', solve([[[1, 'a', 4]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
elif N == 5:
    check('column order', solve([[[1, 'a', 5], [1, 'b', 6]], ['b', 'a']]), [[1, [6], [5]]])
    check('unknown-only row', solve([[[1, 'z', 5]], ['a']]), [[1, []]])
    check('two row groups', solve([[[1, 'a', 5], [2, 'a', 6]], ['a']]), [[1, [5]], [2, [6]]])
    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])
    check('duplicate fact', solve([[[1, 'a', 5], [1, 'a', 5]], ['a']]), [[1, [5, 5]]])
    check('no categories', solve([[[1, 'a', 5]], []]), [[1]])
    check('no facts', solve([[], ['a']]), [])
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
column order[[1, [2], [1]]][[1, [2], [1]]]Passed
unknown-only row[][[1, []]]Failed
two row groups[[1, [1]], [2, [2]]][[1, [1]], [2, [2]]]Passed
null fact[[1, [None]]][[1, [None]]]Passed
duplicate fact[[1, [1, 1]]][[1, [1, 1]]]Passed
no categories[][[1]]Failed
no facts[][]Passed

SHA-256 / 808ce79166be975f4892d20c5aa955c89943cf5c034cab8a4feec8c1b2029376

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:16.836450+00:00.

Case digest / b3b551684e999cc92521ac720c8cc08d82b4c8178f46c1f8b27932a685e6fa1a