Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up cleanup and hardening from reviewing how
measurement-resultJSON documents are converted into Parquet:Schema mapping & conversion hardening (
src/benchx/parquet.py)$reftargets (chained#/$defs/refs, cycle detection, reject external/missing refs).allOf[1:]only contains assertion/annotation keywords rather than silently ignoring extraproperties/$refs; reject emptyallOf.itemsonarraynodes; reject bare{}/anyOf/nullinstead of falling through to JSON.oneOfwith bare numbers only allows"value"as a required field on the structured object branch.bool) scalars when"value"is a struct field; raiseTypeErrorotherwise.zip(..., strict=True)inresults_table.Performance & write-safety improvements
_compile_row, shared withto_row) instead of re-walking the schema, padding missing optional keys withNone, and allocatingpa.json_()per scalar leaf.catalog.schema()(src/benchx/core/catalog.py) sobenchx.parquetreadsschema.jsonwithout constructing a fullDraft202012Validator,Registry, andFormatCheckerat import time.core.canonical(order).decode()perwork_order_refiningest_documents(src/benchx/results.py).Store._index,Store._documents, andStore.head(src/benchx/store.py) so heavy nested columns (observations,summaries,protocol,system, etc.) are skipped when not needed.tempfile.NamedTemporaryFilesiblings inStore._atomic_writeandtools/json_to_parquet.pywith fsync, atomicos.replace, and temp-file cleanup on failure.store._fieldsto walklist<struct>elements ([]), and log warnings onschema_urimismatch or removed fields when appending inStore._write_parquet.Deslopping
is_pyarrow_missing,has_pyarrow,require_pyarrow) intosrc/benchx/_pyarrow.py(with zero top-levelpyarrowimport) and reuseJSON_SUFFIXESinviews/inputs.py.arrow_type'sjson_typethreading and double derivation with a single_FINALderivation +_storage_schema().core.hashing.canonicalconsistently inparquet.py.pip install -e .->pip install -e '.[parquet]'intools/json_to_parquet.pyanddocs/design/measurement-result-parquet.md.Tests & verification
tests/test_parquet.pywith negative schema-node tests, chained/cyclic$reftests, empty/mismatchedmessage_table/results_tabletests, sub-microsecond timestamp truncation, optional schema branches (constraint,derivation,source_bounds,standard_uncertainty,expanded_uncertainty,quality.validation, fullstructuredObservation),_pyarrowedge cases,_fieldslist-of-struct traversal, and atomic write cleanup/warning tests.tests/test_logging_silent.pyfor the projectedprovenance.run_keycolumn name in debug logs.uv run --with ruff==0.17.6 ruff check src tests tools&ruff format --check src tests toolsuv run --extra parquet --extra test --with coverage python -m coverage run -m pytest tests -ra(1171 passed, 18 skipped; 93% total coverage,parquet.py99%,_pyarrow.py100%)uv run --isolated --extra test python -m pytest tests/test_minimal_deps.py tests/test_parquet.py -ra(34 passed, 4 skipped withoutpyarrow)