FAILURE MAP
← Case archive

FA-44921 / Data systems / Open access

Unpivot iterates selected columns in sorted name order · case 01

Unpivot iterates selected columns in sorted name order.

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

ROOT CAUSE

unpivot-presence: Unpivot iterates selected columns in sorted name order.

VERIFIED REPAIR

Preserve the stated physical representation and operation order: Unpivot selected columns of record dictionaries into [id,column,value] rows. Include explicitly present None values, skip absent columns, respect requested column order and repetitions, and retain parent row order.

Unsuccessful approach: Reversed columns still violate the projection order.

Case contract

Unpivot selected columns of record dictionaries into [id,column,value] rows. Include explicitly present None values, skip absent columns, respect requested column order and repetitions, and retain parent row order.

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,columns=d
        result=[]
        for row in rows:
            ident=row['id']
            for column in sorted(columns):
                if column not in row: continue
                result.append([ident,column,row.get(column)])
        return result
    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('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
    check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
    check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
    check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
    check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
    check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
    check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
    check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
    check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
    check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
    check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
    check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
    check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
    check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
    check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, '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
source column order[[9, 'a', 1], [9, 'b', 2]][[9, 'b', 2], [9, 'a', 1]]Failed
explicit null[[9, 'a', None]][[9, 'a', None]]Passed
missing field[[9, 'a', 1]][[9, 'a', 1]]Passed
duplicate column[[9, 'a', 1], [9, 'a', 1]][[9, 'a', 1], [9, 'a', 1]]Passed
parent order[[9, 'a', 1], [2, 'a', 2]][[9, 'a', 1], [2, 'a', 2]]Passed
zero value[[9, 'a', 0]][[9, 'a', 0]]Passed
empty projection[][]Passed

SHA-256 / 780d427ebaae3c5a33b2335f4e13b784096163b92572d1ef5098887a77eef402

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    try:
        rows,columns=d
        result=[]
        for row in rows:
            ident=row['id']
            for column in reversed(columns):
                if column not in row: continue
                result.append([ident,column,row.get(column)])
        return result
    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('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
    check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
    check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
    check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
    check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
    check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
    check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
    check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
    check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
    check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
    check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
    check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
    check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
    check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
    check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, '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
source column order[[9, 'a', 1], [9, 'b', 2]][[9, 'b', 2], [9, 'a', 1]]Failed
explicit null[[9, 'a', None]][[9, 'a', None]]Passed
missing field[[9, 'a', 1]][[9, 'a', 1]]Passed
duplicate column[[9, 'a', 1], [9, 'a', 1]][[9, 'a', 1], [9, 'a', 1]]Passed
parent order[[9, 'a', 1], [2, 'a', 2]][[9, 'a', 1], [2, 'a', 2]]Passed
zero value[[9, 'a', 0]][[9, 'a', 0]]Passed
empty projection[][]Passed

SHA-256 / 3483a9943caef5b3544a2d475d089d63eee227c7316c342728761b6ea43f5042

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    try:
        rows,columns=d
        result=[]
        for row in rows:
            ident=row['id']
            for column in columns:
                if column not in row: continue
                result.append([ident,column,row.get(column)])
        return result
    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('source column order', solve([[{'id': 9, 'a': 1, 'b': 2}], ['b', 'a']]), [[9, 'b', 2], [9, 'a', 1]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 1}], ['a', 'b']]), [[9, 'a', 1]])
    check('duplicate column', solve([[{'id': 9, 'a': 1}], ['a', 'a']]), [[9, 'a', 1], [9, 'a', 1]])
    check('parent order', solve([[{'id': 9, 'a': 1}, {'id': 2, 'a': 2}], ['a']]), [[9, 'a', 1], [2, 'a', 2]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 1}], []]), [])
elif N == 2:
    check('source column order', solve([[{'id': 9, 'a': 2, 'b': 3}], ['b', 'a']]), [[9, 'b', 3], [9, 'a', 2]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 2}], ['a', 'b']]), [[9, 'a', 2]])
    check('duplicate column', solve([[{'id': 9, 'a': 2}], ['a', 'a']]), [[9, 'a', 2], [9, 'a', 2]])
    check('parent order', solve([[{'id': 9, 'a': 2}, {'id': 2, 'a': 3}], ['a']]), [[9, 'a', 2], [2, 'a', 3]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 2}], []]), [])
elif N == 3:
    check('source column order', solve([[{'id': 9, 'a': 3, 'b': 4}], ['b', 'a']]), [[9, 'b', 4], [9, 'a', 3]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 3}], ['a', 'b']]), [[9, 'a', 3]])
    check('duplicate column', solve([[{'id': 9, 'a': 3}], ['a', 'a']]), [[9, 'a', 3], [9, 'a', 3]])
    check('parent order', solve([[{'id': 9, 'a': 3}, {'id': 2, 'a': 4}], ['a']]), [[9, 'a', 3], [2, 'a', 4]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 3}], []]), [])
elif N == 4:
    check('source column order', solve([[{'id': 9, 'a': 4, 'b': 5}], ['b', 'a']]), [[9, 'b', 5], [9, 'a', 4]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 4}], ['a', 'b']]), [[9, 'a', 4]])
    check('duplicate column', solve([[{'id': 9, 'a': 4}], ['a', 'a']]), [[9, 'a', 4], [9, 'a', 4]])
    check('parent order', solve([[{'id': 9, 'a': 4}, {'id': 2, 'a': 5}], ['a']]), [[9, 'a', 4], [2, 'a', 5]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, 'a': 4}], []]), [])
elif N == 5:
    check('source column order', solve([[{'id': 9, 'a': 5, 'b': 6}], ['b', 'a']]), [[9, 'b', 6], [9, 'a', 5]])
    check('explicit null', solve([[{'id': 9, 'a': None}], ['a']]), [[9, 'a', None]])
    check('missing field', solve([[{'id': 9, 'a': 5}], ['a', 'b']]), [[9, 'a', 5]])
    check('duplicate column', solve([[{'id': 9, 'a': 5}], ['a', 'a']]), [[9, 'a', 5], [9, 'a', 5]])
    check('parent order', solve([[{'id': 9, 'a': 5}, {'id': 2, 'a': 6}], ['a']]), [[9, 'a', 5], [2, 'a', 6]])
    check('zero value', solve([[{'id': 9, 'a': 0}], ['a']]), [[9, 'a', 0]])
    check('empty projection', solve([[{'id': 9, '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
source column order[[9, 'b', 2], [9, 'a', 1]][[9, 'b', 2], [9, 'a', 1]]Passed
explicit null[[9, 'a', None]][[9, 'a', None]]Passed
missing field[[9, 'a', 1]][[9, 'a', 1]]Passed
duplicate column[[9, 'a', 1], [9, 'a', 1]][[9, 'a', 1], [9, 'a', 1]]Passed
parent order[[9, 'a', 1], [2, 'a', 2]][[9, 'a', 1], [2, 'a', 2]]Passed
zero value[[9, 'a', 0]][[9, 'a', 0]]Passed
empty projection[][]Passed

SHA-256 / 2592dbe1cfc06f8759d015f54a779497ffd4c343e9df5850a67920e5a3b57bd0

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

Case digest / 4d04f4c2e4f29ed1a7a2ec27dc41971b807fc49f0a314a42533e96494586a2a8