GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — insert_many, GraphBatch.create_vertices, and GraphBatch.new_edges silently wrap an integer beyond 64 bits · Issue #110 · humemai/arcadedb-embedded-python
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
This repository was archived by the owner on Nov 21, 2026. It is now read-only.
insert_many, GraphBatch.create_vertices, and GraphBatch.new_edges silently wrap an integer beyond 64 bits #110Copy link Copy link Closed DescriptionLevel: bindings, with the wrapping done by the engine's JSON parser (ArcadeData#9004). The per-value entry points refuse the same integers: Repro The script prints to stdout. The JVM's own log lines go to stderr and are discarded by the command below. uv venv .venv
uv pip install --python .venv/bin/python arcadedb_embedded-26.10.1.dev0-cp312-cp312-manylinux_2_34_x86_64.whl
.venv/bin/python repro-1-bulk-int-wrap.py 2>/dev/null"""insert_many, create_vertices and new_edges send rows to the JVM as JSON text; an int beyond 64 bits wraps.""" import os import tempfile import arcadedb_embedded as arcade from arcadedb_embedded.jvm import start_jvm start_jvm(heap_size="2g") db = arcade.create_database(os.path.join(tempfile.mkdtemp(prefix="hb1-"), "db")) db.command("sql", "CREATE DOCUMENT TYPE D") db.command("sql", "CREATE VERTEX TYPE V") db.command("sql", "CREATE EDGE TYPE E") def outcome(write): """what a write does with the value: the error it raises, or nothing""" try: write() return None except Exception as e: return type(e).__name__ def read(sql, key): return db.query("sql", sql, key).first().get("v") print(f"{'value written':>34} {'path':<26} {'error':<14} value read back") for v in (2**63 - 1, 2**63, 2**64, 10**30, -(2**63) - 1): key = str(v) def per_row(): with db.transaction(): d = db.new_document("D") d.set("k", "Document.set " + key) d.set("v", v) d.save() rows = [ ("insert_many", lambda: db.insert_many("D", [{"k": "insert_many " + key, "v": v}]), "D"), ("Document.set", per_row, "D"), ] with db.graph_batch() as b: a, c = b.create_vertex("V"), b.create_vertex("V") rows += [ ("create_vertices", lambda: b.create_vertices("V", [{"k": "create_vertices " + key, "v": v}]), "V"), ("create_vertex", lambda: b.create_vertex("V", k="create_vertex " + key, v=v), "V"), ("new_edges", lambda: b.new_edges([a.get_rid()], "E", [c.get_rid()], [{"k": "new_edges " + key, "v": v}]), "E"), ("new_edge", lambda: b.new_edge(a, "E", c, k="new_edge " + key, v=v), "E"), ] results = [(name, outcome(write), typ) for name, write, typ in rows] for name, err, typ in results: r = db.query("sql", f"SELECT FROM {typ} WHERE k = ?", f"{name} {key}").first() got = None if r is None else r.get("v") flag = " <-- WRONG VALUE, no error" if err is None and got != v else "" print(f"{v:>34} {name:<26} {str(err):<14} {got}{flag}") db.close() Output Wheel A property test (hypothesis 6.168.3, seed 20261003, 500 examples per writer) finds the same through the three JSON entry points and passes for the other eight. Every row marked Cause The payloads are built by The Java side reads the text with the engine's The rows reach Expected An integer beyond 64 bits raises the same error on every entry point (the Proposed fix Keep such values off the JSON path, which is where the bindings already decide what is JSON-safe. --- a/bindings/python/src/arcadedb_embedded/graph_batch.py +++ b/bindings/python/src/arcadedb_embedded/graph_batch.py - _JSON_SAFE_TYPES = (str, int, float, bool, type(None)) + @staticmethod + def _json_safe(value): + if value is None or isinstance(value, (str, bool)): + return True + if isinstance(value, int): + return -(2**63) <= value < 2**63 + return isinstance(value, float) and math.isfinite(value) @@ _create_vertices_json_bulk and new_edges: replace isinstance(value, json_safe) with self._json_safe(value) --- a/bindings/python/src/arcadedb_embedded/core.py +++ b/bindings/python/src/arcadedb_embedded/core.py - payload = _json.dumps(rows) + _require_json_safe(rows) # raises ValueError for an int beyond 64 bits, so the per-row path below runs + payload = _json.dumps(rows, allow_nan=False) I checked the effect of the same guard with a run-time monkeypatch that leaves the repository untouched. With it, Related issues ArcadeData#9004 (open) is the engine cause, filed for the HTTP parameter parser. This report is the embedded Python entry points that reach the same parser: the bindings turn a value that JPype refuses ( In this repository's tracker no issue is about this. The searches for Related reports from the same review: #111 (NaN, Infinity, dict keys, lone surrogates). ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |