FAILURE MAP
← Case archive

FA-44466 / Data systems / Open access

Struct projection sorts requested fields by storage name · case 01

Struct projection sorts requested fields by storage name.

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

ROOT CAUSE

struct-vector-project: Struct projection sorts requested fields by storage name.

VERIFIED REPAIR

Preserve the stated physical representation and operation order: Project requested fields from a struct array. Parent validity dominates field validity, absent schema fields materialize None, selection retains row order, and projection retains requested field order.

Unsuccessful approach: Deduplicating a projection removes intentionally repeated result columns.

Case contract

Project requested fields from a struct array. Parent validity dominates field validity, absent schema fields materialize None, selection retains row order, and projection retains requested field 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:
        columns,valid,parent,selection,fields=d
        out=[]
        for row in selection:
            record=[]
            for field in sorted(fields):
                present=field in columns
                known=present and valid[field][row]
                value=columns[field][row] if present else None
                record.append(value if parent[row] and known else None)
            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('gather with field order', solve([{'a': [1, 2], 'b': [3, 4]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[4, 2], [3, 1]])
    check('parent hides values', solve([{'a': [1, 2]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [2]])
    check('field null lane', solve([{'a': [1, 2]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [2]])
    check('missing field', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[1, None]])
    check('repeated projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[1, 1]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 2:
    check('gather with field order', solve([{'a': [2, 3], 'b': [4, 5]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[5, 3], [4, 2]])
    check('parent hides values', solve([{'a': [2, 3]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [3]])
    check('field null lane', solve([{'a': [2, 3]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [3]])
    check('missing field', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[2, None]])
    check('repeated projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[2, 2]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 3:
    check('gather with field order', solve([{'a': [3, 4], 'b': [5, 6]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[6, 4], [5, 3]])
    check('parent hides values', solve([{'a': [3, 4]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [4]])
    check('field null lane', solve([{'a': [3, 4]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [4]])
    check('missing field', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[3, None]])
    check('repeated projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[3, 3]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 4:
    check('gather with field order', solve([{'a': [4, 5], 'b': [6, 7]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[7, 5], [6, 4]])
    check('parent hides values', solve([{'a': [4, 5]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [5]])
    check('field null lane', solve([{'a': [4, 5]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [5]])
    check('missing field', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[4, None]])
    check('repeated projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[4, 4]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 5:
    check('gather with field order', solve([{'a': [5, 6], 'b': [7, 8]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[8, 6], [7, 5]])
    check('parent hides values', solve([{'a': [5, 6]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [6]])
    check('field null lane', solve([{'a': [5, 6]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [6]])
    check('missing field', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[5, None]])
    check('repeated projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[5, 5]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], []]), [[]])
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
gather with field order[[2, 4], [1, 3]][[4, 2], [3, 1]]Failed
parent hides values[[None], [2]][[None], [2]]Passed
field null lane[[None], [2]][[None], [2]]Passed
missing field[[1, None]][[1, None]]Passed
repeated projection[[1, 1]][[1, 1]]Passed
empty rows[][]Passed
empty projection[[]][[]]Passed

SHA-256 / d0dc49b9fff8f8436e0b4abcd6cdf0456109d1199c4fe4be17f417be5f374f2b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    try:
        columns,valid,parent,selection,fields=d
        out=[]
        for row in selection:
            record=[]
            for field in dict.fromkeys(fields):
                present=field in columns
                known=present and valid[field][row]
                value=columns[field][row] if present else None
                record.append(value if parent[row] and known else None)
            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('gather with field order', solve([{'a': [1, 2], 'b': [3, 4]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[4, 2], [3, 1]])
    check('parent hides values', solve([{'a': [1, 2]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [2]])
    check('field null lane', solve([{'a': [1, 2]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [2]])
    check('missing field', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[1, None]])
    check('repeated projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[1, 1]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 2:
    check('gather with field order', solve([{'a': [2, 3], 'b': [4, 5]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[5, 3], [4, 2]])
    check('parent hides values', solve([{'a': [2, 3]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [3]])
    check('field null lane', solve([{'a': [2, 3]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [3]])
    check('missing field', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[2, None]])
    check('repeated projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[2, 2]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 3:
    check('gather with field order', solve([{'a': [3, 4], 'b': [5, 6]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[6, 4], [5, 3]])
    check('parent hides values', solve([{'a': [3, 4]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [4]])
    check('field null lane', solve([{'a': [3, 4]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [4]])
    check('missing field', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[3, None]])
    check('repeated projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[3, 3]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 4:
    check('gather with field order', solve([{'a': [4, 5], 'b': [6, 7]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[7, 5], [6, 4]])
    check('parent hides values', solve([{'a': [4, 5]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [5]])
    check('field null lane', solve([{'a': [4, 5]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [5]])
    check('missing field', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[4, None]])
    check('repeated projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[4, 4]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 5:
    check('gather with field order', solve([{'a': [5, 6], 'b': [7, 8]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[8, 6], [7, 5]])
    check('parent hides values', solve([{'a': [5, 6]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [6]])
    check('field null lane', solve([{'a': [5, 6]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [6]])
    check('missing field', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[5, None]])
    check('repeated projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[5, 5]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], []]), [[]])
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
gather with field order[[4, 2], [3, 1]][[4, 2], [3, 1]]Passed
parent hides values[[None], [2]][[None], [2]]Passed
field null lane[[None], [2]][[None], [2]]Passed
missing field[[1, None]][[1, None]]Passed
repeated projection[[1]][[1, 1]]Failed
empty rows[][]Passed
empty projection[[]][[]]Passed

SHA-256 / 9d994d4a1369b1065342c1e3d59a573a752cdbc252db7719208f8e0eeb1e81ff

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    try:
        columns,valid,parent,selection,fields=d
        out=[]
        for row in selection:
            record=[]
            for field in fields:
                present=field in columns
                known=present and valid[field][row]
                value=columns[field][row] if present else None
                record.append(value if parent[row] and known else None)
            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('gather with field order', solve([{'a': [1, 2], 'b': [3, 4]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[4, 2], [3, 1]])
    check('parent hides values', solve([{'a': [1, 2]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [2]])
    check('field null lane', solve([{'a': [1, 2]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [2]])
    check('missing field', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[1, None]])
    check('repeated projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[1, 1]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [1]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 2:
    check('gather with field order', solve([{'a': [2, 3], 'b': [4, 5]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[5, 3], [4, 2]])
    check('parent hides values', solve([{'a': [2, 3]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [3]])
    check('field null lane', solve([{'a': [2, 3]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [3]])
    check('missing field', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[2, None]])
    check('repeated projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[2, 2]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [2]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 3:
    check('gather with field order', solve([{'a': [3, 4], 'b': [5, 6]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[6, 4], [5, 3]])
    check('parent hides values', solve([{'a': [3, 4]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [4]])
    check('field null lane', solve([{'a': [3, 4]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [4]])
    check('missing field', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[3, None]])
    check('repeated projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[3, 3]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [3]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 4:
    check('gather with field order', solve([{'a': [4, 5], 'b': [6, 7]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[7, 5], [6, 4]])
    check('parent hides values', solve([{'a': [4, 5]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [5]])
    check('field null lane', solve([{'a': [4, 5]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [5]])
    check('missing field', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[4, None]])
    check('repeated projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[4, 4]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [4]}, {'a': [True]}, [True], [0], []]), [[]])
elif N == 5:
    check('gather with field order', solve([{'a': [5, 6], 'b': [7, 8]}, {'a': [True, True], 'b': [True, True]}, [True, True], [1, 0], ['b', 'a']]), [[8, 6], [7, 5]])
    check('parent hides values', solve([{'a': [5, 6]}, {'a': [True, True]}, [False, True], [0, 1], ['a']]), [[None], [6]])
    check('field null lane', solve([{'a': [5, 6]}, {'a': [False, True]}, [True, True], [0, 1], ['a']]), [[None], [6]])
    check('missing field', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'missing']]), [[5, None]])
    check('repeated projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], ['a', 'a']]), [[5, 5]])
    check('empty rows', solve([{'a': []}, {'a': []}, [], [], ['a']]), [])
    check('empty projection', solve([{'a': [5]}, {'a': [True]}, [True], [0], []]), [[]])
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
gather with field order[[4, 2], [3, 1]][[4, 2], [3, 1]]Passed
parent hides values[[None], [2]][[None], [2]]Passed
field null lane[[None], [2]][[None], [2]]Passed
missing field[[1, None]][[1, None]]Passed
repeated projection[[1, 1]][[1, 1]]Passed
empty rows[][]Passed
empty projection[[]][[]]Passed

SHA-256 / d130665f6d9eb307fa1c3d2f5e9140f3d3400bbd3dd72e2baba761a0b23ebff2

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

Case digest / 744f4a19ce337fbff3b610dbe2c310e7eb459c1a6c82eb6c47df6515606ac5dd