broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] for i in range(lo,hi)]
            out.append(items if parents[row] else None)
        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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] for i in range(lo,hi) if valid[i]]
            out.append(items if parents[row] else None)
        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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

prompt:
Nested list decoding ignores child validity.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items)
        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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] else [])
        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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

prompt:
A null list exposes its physically retained child values.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] else None)
        return [v for v in out if v != []]
    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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        offsets,child,parents,valid,selection=d
        out=[]
        for row in selection:
            lo=offsets[row]
            hi=offsets[row+1]
            items=[child[i] if valid[i] else None for i in range(lo,hi)]
            out.append(items if parents[row] else None)
        return [v or None for v in 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('shared child offsets', solve([[0, 2, 3], [1, 2, 3], [True, True], [True, True, True], [1, 0]]), [[3], [1, 2]])
    check('null child', solve([[0, 2], [1, 2], [True], [False, True], [0]]), [[None, 2]])
    check('hidden null list', solve([[0, 2], [1, 2], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [1], [True, True], [True], [0, 1]]), [[], [1]])
    check('repeated list', solve([[0, 1, 2], [1, 2], [True, True], [True, True], [1, 1]]), [[2], [2]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 1, 2], [True], [True, True, True], [0]]), [[1, 2]])
elif N == 2:
    check('shared child offsets', solve([[0, 2, 3], [2, 3, 4], [True, True], [True, True, True], [1, 0]]), [[4], [2, 3]])
    check('null child', solve([[0, 2], [2, 3], [True], [False, True], [0]]), [[None, 3]])
    check('hidden null list', solve([[0, 2], [2, 3], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [2], [True, True], [True], [0, 1]]), [[], [2]])
    check('repeated list', solve([[0, 1, 2], [2, 3], [True, True], [True, True], [1, 1]]), [[3], [3]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 2, 3], [True], [True, True, True], [0]]), [[2, 3]])
elif N == 3:
    check('shared child offsets', solve([[0, 2, 3], [3, 4, 5], [True, True], [True, True, True], [1, 0]]), [[5], [3, 4]])
    check('null child', solve([[0, 2], [3, 4], [True], [False, True], [0]]), [[None, 4]])
    check('hidden null list', solve([[0, 2], [3, 4], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [3], [True, True], [True], [0, 1]]), [[], [3]])
    check('repeated list', solve([[0, 1, 2], [3, 4], [True, True], [True, True], [1, 1]]), [[4], [4]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 3, 4], [True], [True, True, True], [0]]), [[3, 4]])
elif N == 4:
    check('shared child offsets', solve([[0, 2, 3], [4, 5, 6], [True, True], [True, True, True], [1, 0]]), [[6], [4, 5]])
    check('null child', solve([[0, 2], [4, 5], [True], [False, True], [0]]), [[None, 5]])
    check('hidden null list', solve([[0, 2], [4, 5], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [4], [True, True], [True], [0, 1]]), [[], [4]])
    check('repeated list', solve([[0, 1, 2], [4, 5], [True, True], [True, True], [1, 1]]), [[5], [5]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 4, 5], [True], [True, True, True], [0]]), [[4, 5]])
elif N == 5:
    check('shared child offsets', solve([[0, 2, 3], [5, 6, 7], [True, True], [True, True, True], [1, 0]]), [[7], [5, 6]])
    check('null child', solve([[0, 2], [5, 6], [True], [False, True], [0]]), [[None, 6]])
    check('hidden null list', solve([[0, 2], [5, 6], [False], [True, True], [0]]), [None])
    check('empty valid list', solve([[0, 0, 1], [5], [True, True], [True], [0, 1]]), [[], [5]])
    check('repeated list', solve([[0, 1, 2], [5, 6], [True, True], [True, True], [1, 1]]), [[6], [6]])
    check('no rows', solve([[0], [], [], [], []]), [])
    check('nonzero physical origin', solve([[1, 3], [0, 5, 6], [True], [True, True, True], [0]]), [[5, 6]])
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)

prompt:
Empty valid lists are converted into absent rows.

Gather selected list rows from offset-based child storage. Parent nullness hides child storage; empty valid lists remain []; child nulls remain None. Preserve repeated selected rows and list element order.

split: open-access


broken_source:
"""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 range(len(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)

source:
"""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 sorted(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)

prompt:
Struct projection ignores a gathered row selection.

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.

split: open-access


broken_source:
"""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)

source:
"""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)

prompt:
Struct projection sorts requested fields by storage name.

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.

split: open-access


broken_source:
"""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=all(f in columns for f in fields)
                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)

source:
"""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 and field==fields[0]
                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)

prompt:
Struct projection treats absent fields as fatal for every field.

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.

split: open-access


broken_source:
"""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
                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)

source:
"""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 all(valid[field])
                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)

prompt:
A struct field exposes values beneath null field lanes.

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.

split: open-access


broken_source:
"""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][0] 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)

source:
"""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][-1] 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)

prompt:
A projected struct field broadcasts its first lane.

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.

split: open-access


broken_source:
"""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 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)

source:
"""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] or 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)

prompt:
Child validity replaces the containing struct validity.

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.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        tags,offsets,names,children,valid,parent,selection=d
        out=[]
        for row in sorted(selection):
            tag=tags[row]
            name=names[str(tag)]
            offset=offsets[row]
            value=children[name][offset] if valid[name][offset] else None
            out.append([name,value] if parent[row] else None)
        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('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [1, 2, 3], 'b': [4, 5, 6]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 1], ['a', 2], ['b', 4]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [1, 2]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 2]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [True], [0, 0]]), [['a', 1], ['a', 1]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [1, 2], 'b': [3, 4]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 4]])
elif N == 2:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [2, 3, 4], 'b': [5, 6, 7]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 2], ['a', 3], ['b', 5]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [2, 3]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 3]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [True], [0, 0]]), [['a', 2], ['a', 2]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [2, 3], 'b': [4, 5]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 5]])
elif N == 3:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [3, 4, 5], 'b': [6, 7, 8]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 3], ['a', 4], ['b', 6]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [3, 4]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 4]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [True], [0, 0]]), [['a', 3], ['a', 3]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [3, 4], 'b': [5, 6]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 6]])
elif N == 4:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [4, 5, 6], 'b': [7, 8, 9]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 4], ['a', 5], ['b', 7]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [4, 5]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 5]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [True], [0, 0]]), [['a', 4], ['a', 4]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [4, 5], 'b': [6, 7]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 7]])
elif N == 5:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [5, 6, 7], 'b': [8, 9, 10]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 5], ['a', 6], ['b', 8]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [5, 6]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 6]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [True], [0, 0]]), [['a', 5], ['a', 5]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [5, 6], 'b': [7, 8]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 8]])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        tags,offsets,names,children,valid,parent,selection=d
        out=[]
        for row in dict.fromkeys(selection):
            tag=tags[row]
            name=names[str(tag)]
            offset=offsets[row]
            value=children[name][offset] if valid[name][offset] else None
            out.append([name,value] if parent[row] else None)
        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('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [1, 2, 3], 'b': [4, 5, 6]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 1], ['a', 2], ['b', 4]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [1, 2]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 2]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [True], [0, 0]]), [['a', 1], ['a', 1]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [1]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [1, 2], 'b': [3, 4]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 4]])
elif N == 2:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [2, 3, 4], 'b': [5, 6, 7]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 2], ['a', 3], ['b', 5]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [2, 3]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 3]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [True], [0, 0]]), [['a', 2], ['a', 2]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [2]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [2, 3], 'b': [4, 5]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 5]])
elif N == 3:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [3, 4, 5], 'b': [6, 7, 8]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 3], ['a', 4], ['b', 6]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [3, 4]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 4]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [True], [0, 0]]), [['a', 3], ['a', 3]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [3]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [3, 4], 'b': [5, 6]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 6]])
elif N == 4:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [4, 5, 6], 'b': [7, 8, 9]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 4], ['a', 5], ['b', 7]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [4, 5]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 5]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [True], [0, 0]]), [['a', 4], ['a', 4]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [4]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [4, 5], 'b': [6, 7]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 7]])
elif N == 5:
    check('mixed tags', solve([[7, 9, 7], [1, 0, 0], {'7': 'a', '9': 'b'}, {'a': [5, 6, 7], 'b': [8, 9, 10]}, {'a': [True, True, True], 'b': [True, True, True]}, [True, True, True], [2, 0, 1]]), [['a', 5], ['a', 6], ['b', 8]])
    check('child null', solve([[7, 7], [0, 1], {'7': 'a'}, {'a': [5, 6]}, {'a': [False, True]}, [True, True], [0, 1]]), [['a', None], ['a', 6]])
    check('parent null', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [False], [0]]), [None])
    check('repeat row', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [True], [0, 0]]), [['a', 5], ['a', 5]])
    check('empty selection', solve([[7], [0], {'7': 'a'}, {'a': [5]}, {'a': [True]}, [True], []]), [])
    check('second tag', solve([[9], [1], {'7': 'a', '9': 'b'}, {'a': [5, 6], 'b': [7, 8]}, {'a': [True, True], 'b': [True, True]}, [True], [0]]), [['b', 8]])
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)

prompt:
Dense union gather sorts logical row addresses.

Decode a dense tagged union. Tags select named child buffers through a tag map; offsets address those buffers independently of output position. Parent and selected child validity both apply. Emit [child-name,value] for valid parents, None for null parents.

split: open-access