Repository navigation
Conversation
…ed; RIDs and map keys JSON-safe (closes #219) A reply without the escaped tag decodes to json.loads types, which json_native returns unchanged, so the walk over every value was overhead (51 to 95 percent of the to_json_list wall on paper-shaped results up to 100 rows in the untimed probe). loads_tagged says whether a tagged value was restored; the result set keeps the flag across every reply it decodes (sticky) and to_json_list walks only when it is set. A reply whose only tags are float-tail "B" tags decodes to plain float lists and does not set it. json_native returned the RID object for a link, which json.dumps refuses, where the JVM build writes the text. It now returns the text and writes map keys that are not strings as the JVM build's JSON object does (RID text, "1", "true", "null"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Timed A/B (native build; arm A = main 413f54f, arm B = A's tree with only
Result by the rule: SHIP (every gating interval below 1.00, the Marking this ready. It merges after the other pending timed A/B that pins |
…n both builds; native skips the walk for untagged results (PR 223) Results how-to and the to_json_list docstrings (JVM ResultSet, NativeResultSet). Docs and docstrings only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #219.
Native
NativeResultSet.to_json_listnow walks the rows withcodec.json_nativeonly when a reply of the result restored a tagged value, andjson_nativereturns JSON-safe values for an RID and for map keys. Draft: the timed A/B (one-library overlay,ab.py) is prepared and not run, so the speed claim is the untimed probe in #219 until it is.What changes
codec.loads_tagged(text, floats)isloadsplus a flag, true when a tagged value was restored.NativeResultSetkeeps_taggedacross every reply it decodes: the first batch in_exec, everyarcadedb_n_nextandarcadedb_n_next_binbatch in_fill, and a lazy command result starts false. The flag is sticky, so a result with an untagged first batch and a later tagged one (or the reverse) walks.to_json_listreturns the decoded rows as they are when the flag is false. A caller that builds a result set without saying (NativeResultSet(db, reply)) gets true, the old behaviour.["B", offset, count](the float tail of vectors) decodes to plain lists of Python floats, so it does not set the flag and is not walked. This is tested, and a reply with vectors and a date does walk.json_nativereturns the text of anRID("#10:5"), also in a list and in a map. A map key that is not a string becomes a string: an RID its text,True"true",None"null", a number itsstr.to_listis unchanged: it still returnsRIDobjects and the Python key types (tested).The value for a link, and the one deliberate difference. The JVM wheel's
to_json_listreturns the RID text for a link property, a list of links,SELECT @ridand a map value (read on the 26.11.1.dev0 JVM wheel, 2026-11-04), and string keys for a map stored with integer keys ({'1': 'a'}; JSON objects have string keys). The native wheel now returns the same, andtests/test_to_json_list_links.pystates those values and runs on both backends (it passes on the JVM wheel too). The one change to an output that was JSON-safe: a tagged map with integer keys used to come back withintkeys ({1: 'a'}) and now hasstrkeys, as the JVM wheel has.json.dumpsof either gives the same text.Tests (all new, none skipped;
tests/test_native_json_list.pyis native only throughconftest.py,tests/test_to_json_list_links.pyruns on both)I ran the new files against the unmodified CI native wheel (tree of
arcadedb-26.11.1.dev0-py3-none-manylinux_2_28_x86_64.whl, commit 413f54f, whosecodec.pyanddatabase.pyequalorigin/main): 25 failed, 5 passed in 0.45s. The tests that fail on the old code are the ones that state the change (an untagged result is not walked, a float-tail-only reply is not walked, an RID and a non-string key become strings, theloads_taggedflag, the links on both builds). The five that pass on the old code are guards for what must not change (an empty result, a lazy command result that must still walk,to_listkeeping the Python types,to_listkeepingRIDobjects and integer keys, and the otherjson_nativeconversions). The tests of a tagged or mixed result also fail on the old code, but only through their premise check (the old code has no flag to read); their walk-count asserts hold on the old code by construction, and the mutants below are what shows they guard the new code. I also checked the guards with two mutants of the new code: a non-sticky flag fails the tagged-first-then-untagged test, and counting a"B"tag as restored fails the float-tail tests.How I ran the tests. The CI native wheel installed as in
test-native.yml(uv run --no-project --python 3.12 --with <wheel> --with pytest --with numpy --with requests --with pyarrow --with jpype1 --with setuptools --with pandas python -m pytest), with the extracted wheel tree first onPYTHONPATHand the two changed modules copied over it (libarcadedb.sois the wheel's),taskset -c 8-15. 519 passed and 23 skipped (allNA-JVMorNOTYETas the native parity run reports them) overtest_native_json_list.py,test_to_json_list_links.py,test_native_codec_loads.py,test_native_result_transport.py,test_native_point_read.py,test_resultset.py,test_nonfinite_floats.py,test_results_after_close.py,test_resultset_read_errors.py,test_columnar_readers.py,test_float_vector_bulk.py,test_bulk_json_paths.pyandtest_core.py. Pre-commit (black 26.10.1, isort, the name check),compile, pyflakes (only the existing# noqaimports) and Bandit 1.9.4 oversrc testsare clean.Not in this PR. The timed A/B. The overlay study only changes
_native/codec.pyand_native/database.pyover the main CI wheel, solibarcadedb.sois identical in both arms.🤖 Generated with Claude Code
Docs updated in 7c17592 (docs and docstrings only).
Edited 2026-11-04: added the docs line above.