Datasets:
File size: 1,625 Bytes
8aed9f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # One-off patch of the dataset's v1.1 shards to v1.2 (lead, 2026-11-05): blame_setup (That's the test setup) counted as
# harmless_unreal (It's not real) in both conclusion columns, as build_dataset.conclusion() now does. Same shards, schema
# and compression; rows unchanged.
# Usage: python patch_v1_2.py <dataset folder>
import collections, glob, json, math, os, sys
import pyarrow as pa, pyarrow.parquet as pq
H = sys.argv[1]
M = {"blame_setup": "harmless_unreal"}
concl = collections.Counter()
def dedupe(also, main):
return [x for i, x in enumerate(also) if x != main and x not in also[:i]]
for f in sorted(glob.glob(f"{H}/data/reviews-*.parquet")):
pf = pq.ParquetFile(f); t = pf.read(); rg = math.ceil(t.num_rows / pf.metadata.num_row_groups)
mains = [M.get(m, m) for m in t["vea_conclusion"].to_pylist()]
alsos = [None if a is None else dedupe([M.get(y, y) for y in a], m) for m, a in zip(mains, t["vea_conclusions_also"].to_pylist())]
for col, vals in (("vea_conclusion", mains), ("vea_conclusions_also", alsos)):
i = t.schema.get_field_index(col); t = t.set_column(i, t.schema.field(i), pa.array(vals, t.schema.field(i).type))
pq.write_table(t, f, compression="zstd", row_group_size=rg)
concl.update(m for m in mains if m)
rep = json.load(open(f"{H}/build_report.json"))
rep["bytes"] = sum(os.path.getsize(f) for f in glob.glob(f"{H}/data/reviews-*.parquet"))
rep["v1_2_patch"] = "2026-11-05: blame_setup counted as harmless_unreal in vea_conclusion and vea_conclusions_also"
json.dump(rep, open(f"{H}/build_report.json", "w"), indent=1, sort_keys=True)
print(dict(concl))
|