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

N = 1
observations = []
def solve(d):
    try:
        fragments,projection=d
        out=[]
        for partition,rows in [(fragments[0][0],r) for p,r in fragments]:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
        fragments,projection=d
        out=[]
        for partition,rows in [(fragments[-1][0],r) for p,r in fragments]:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
Partition injection reuses the first file fragment partition.

Read ordered file fragments [partition-values,physical-rows] under a projection of field names. Partition values override stale physical columns of the same name; unprojected fields disappear, missing fields become None, and physically empty fragments do not synthesize rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows or [{}]:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows or [partition]:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
Partition injection invents one row for an empty file fragment.

Read ordered file fragments [partition-values,physical-rows] under a projection of field names. Partition values override stale physical columns of the same name; unprojected fields disappear, missing fields become None, and physically empty fragments do not synthesize rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in sorted(projection)])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in dict.fromkeys(projection)])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
Partition injection sorts requested result columns.

Read ordered file fragments [partition-values,physical-rows] under a projection of field names. Partition values override stale physical columns of the same name; unprojected fields disappear, missing fields become None, and physically empty fragments do not synthesize rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name, "") for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name, 0) for name in projection])
        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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
Partition injection uses an empty string for missing fields.

Read ordered file fragments [partition-values,physical-rows] under a projection of field names. Partition values override stale physical columns of the same name; unprojected fields disappear, missing fields become None, and physically empty fragments do not synthesize rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        return [r for i,r in enumerate(out) if r not in out[:i]]
    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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
        fragments,projection=d
        out=[]
        for partition,rows in fragments:
            for row in rows:
                merged=dict(row)
                merged.update(partition)
                out.append([merged.get(name) for name in projection])
        return [r for i,r in enumerate(out) if i==0 or r!=out[i-1]]
    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('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 1}]]], ['v', 'p']]), [[1, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 1}]], [{'p': 'b'}, [{'v': 2}]]], ['p', 'v']]), [['a', 1], ['b', 2]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 1}]]], ['v', 'x']]), [[1, None]])
    check('duplicate rows', solve([[[{}, [{'v': 1}, {'v': 1}]]], ['v']]), [[1], [1]])
    check('duplicate projection', solve([[[{}, [{'v': 1}]]], ['v', 'v']]), [[1, 1]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 2:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 2}]]], ['v', 'p']]), [[2, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 2}]], [{'p': 'b'}, [{'v': 3}]]], ['p', 'v']]), [['a', 2], ['b', 3]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 2}]]], ['v', 'x']]), [[2, None]])
    check('duplicate rows', solve([[[{}, [{'v': 2}, {'v': 2}]]], ['v']]), [[2], [2]])
    check('duplicate projection', solve([[[{}, [{'v': 2}]]], ['v', 'v']]), [[2, 2]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 3:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 3}]]], ['v', 'p']]), [[3, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 3}]], [{'p': 'b'}, [{'v': 4}]]], ['p', 'v']]), [['a', 3], ['b', 4]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 3}]]], ['v', 'x']]), [[3, None]])
    check('duplicate rows', solve([[[{}, [{'v': 3}, {'v': 3}]]], ['v']]), [[3], [3]])
    check('duplicate projection', solve([[[{}, [{'v': 3}]]], ['v', 'v']]), [[3, 3]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 4:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 4}]]], ['v', 'p']]), [[4, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 4}]], [{'p': 'b'}, [{'v': 5}]]], ['p', 'v']]), [['a', 4], ['b', 5]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 4}]]], ['v', 'x']]), [[4, None]])
    check('duplicate rows', solve([[[{}, [{'v': 4}, {'v': 4}]]], ['v']]), [[4], [4]])
    check('duplicate projection', solve([[[{}, [{'v': 4}]]], ['v', 'v']]), [[4, 4]])
    check('no fragments', solve([[], ['v']]), [])
elif N == 5:
    check('partition overrides', solve([[[{'p': 'new'}, [{'p': 'old', 'v': 5}]]], ['v', 'p']]), [[5, 'new']])
    check('multiple fragments', solve([[[{'p': 'a'}, [{'v': 5}]], [{'p': 'b'}, [{'v': 6}]]], ['p', 'v']]), [['a', 5], ['b', 6]])
    check('empty fragment', solve([[[{'p': 'a'}, []]], ['p']]), [])
    check('missing projected', solve([[[{}, [{'v': 5}]]], ['v', 'x']]), [[5, None]])
    check('duplicate rows', solve([[[{}, [{'v': 5}, {'v': 5}]]], ['v']]), [[5], [5]])
    check('duplicate projection', solve([[[{}, [{'v': 5}]]], ['v', 'v']]), [[5, 5]])
    check('no fragments', solve([[], ['v']]), [])
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:
Partition scan deduplicates identical physical rows.

Read ordered file fragments [partition-values,physical-rows] under a projection of field names. Partition values override stale physical columns of the same name; unprojected fields disappear, missing fields become None, and physically empty fragments do not synthesize rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and True]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel.startswith(qualifier))]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Column binding ignores explicit relation qualifiers.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col.lower()==name.lower() and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col.strip()==name.strip() and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Column binding folds case in a case-sensitive schema.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append(matches[0])
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append(matches[-1])
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Column binding silently takes the first ambiguous candidate.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append(0)
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append(None)
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A missing query column binds to field ID zero.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(name)
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in references:
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(qualifier)
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Column binding emits display names instead of stable field IDs.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access


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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in sorted(references,key=repr):
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    try:
        schema,references=d
        out=[]
        for qualifier,name in dict.fromkeys(tuple(r) for r in references):
            matches=[field for rel,col,field in schema if col==name and (qualifier is None or rel==qualifier)]
            if not matches: out.append('MISSING')
            elif len(matches)>1: out.append('AMBIGUOUS')
            else: out.append(matches[0])
        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('qualified same name', solve([[['a', 'x', 1], ['b', 'x', 2]], [['b', 'x'], ['a', 'x']]]), [2, 1])
    check('ambiguous', solve([[['a', 'x', 1], ['b', 'x', 2]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 1]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 1]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 1]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 1]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 1]], [['a', 'x'], ['a', 'x']]]), [1, 1])
elif N == 2:
    check('qualified same name', solve([[['a', 'x', 2], ['b', 'x', 3]], [['b', 'x'], ['a', 'x']]]), [3, 2])
    check('ambiguous', solve([[['a', 'x', 2], ['b', 'x', 3]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 2]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 2]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 2]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 2]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 2]], [['a', 'x'], ['a', 'x']]]), [2, 2])
elif N == 3:
    check('qualified same name', solve([[['a', 'x', 3], ['b', 'x', 4]], [['b', 'x'], ['a', 'x']]]), [4, 3])
    check('ambiguous', solve([[['a', 'x', 3], ['b', 'x', 4]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 3]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 3]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 3]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 3]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 3]], [['a', 'x'], ['a', 'x']]]), [3, 3])
elif N == 4:
    check('qualified same name', solve([[['a', 'x', 4], ['b', 'x', 5]], [['b', 'x'], ['a', 'x']]]), [5, 4])
    check('ambiguous', solve([[['a', 'x', 4], ['b', 'x', 5]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 4]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 4]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 4]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 4]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 4]], [['a', 'x'], ['a', 'x']]]), [4, 4])
elif N == 5:
    check('qualified same name', solve([[['a', 'x', 5], ['b', 'x', 6]], [['b', 'x'], ['a', 'x']]]), [6, 5])
    check('ambiguous', solve([[['a', 'x', 5], ['b', 'x', 6]], [[None, 'x']]]), ['AMBIGUOUS'])
    check('missing', solve([[['a', 'x', 5]], [['a', 'z']]]), ['MISSING'])
    check('case-sensitive', solve([[['a', 'X', 5]], [[None, 'x']]]), ['MISSING'])
    check('alias-prefix', solve([[['ab', 'x', 5]], [['a', 'x']]]), ['MISSING'])
    check('literal-space', solve([[['a', ' x ', 5]], [[None, 'x']]]), ['MISSING'])
    check('repeat ref', solve([[['a', 'x', 5]], [['a', 'x'], ['a', 'x']]]), [5, 5])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Column binding sorts expression references before binding.

Resolve query references [qualifier-or-None,name] against schema entries [relation,name,field-id]. Unqualified names bind only when exactly one matching column exists. Qualified names use both relation and name; no candidates yields MISSING and several yield AMBIGUOUS. Return stable field IDs.

split: open-access