Repository navigation
Description
Summary
On the JVM wheel, GraphBatch.new_edges(..., properties=[...]) stores a subnormal double (for example 5e-324) as a DECIMAL, so it reads back as decimal.Decimal. Every other write path stores a double: new_edge, insert_many, create_vertices, SQL, Document.set.
Cause
The engine's JSON parser reads the text of a subnormal (5e-324) as a BigDecimal. The bulk paths guard against this: json_bulk_dumps and json_bulk_dumps_tagged run _dumps_checked, which refuses the rows with a ValueError so the caller falls back to the per-value path, which stores the double. This is pinned for insert_many and create_vertices (tests/test_columnar_readers.py, tests/test_graph_batch_single_pass.py).
GraphBatch.new_edges has two branches. The tagged branch calls json_bulk_dumps_tagged and falls back per edge on ValueError. The untagged branch (no date-time, date, Decimal, bytes, list or dict value) calls plain json.dumps(...) (src/arcadedb/graph_batch.py, new_edges, if not tagged:), which has no subnormal check and no fallback. The existing parametrized tests in tests/test_bulk_json_paths.py cover integers beyond 64 bits, NaN, infinities, non-str keys and lone surrogates for new_edges, but not subnormals.
Reproduction
import tempfile
import arcadedb
print(arcadedb.__backend__, arcadedb.__version__)
with arcadedb.create_database(tempfile.mkdtemp() + "/db") as db:
db.command("sql", "CREATE VERTEX TYPE V")
db.command("sql", "CREATE EDGE TYPE E")
with db.transaction():
a = db.new_vertex("V").save()
b = db.new_vertex("V").save()
with db.graph_batch() as g:
g.new_edges([a.get_rid()], "E", [b.get_rid()], properties=[{"x": 5e-324}])
with db.graph_batch() as g:
g.new_edge(a.get_rid(), "E", b.get_rid(), y=5e-324)
for prop in ("x", "y"):
stored = db.query("sql", f"SELECT {prop} FROM E WHERE {prop} IS NOT NULL").first().get(prop)
print(prop, type(stored).__name__, repr(stored))Output on arcadedb-jvm 26.12.1.dev0 (built from main at 0c3c7ec, macOS arm64, Python 3.12):
jvm 26.12.1.dev0
x Decimal Decimal('5E-324')
y float 5e-324
Expected
Both properties are doubles. A subnormal in an edge property sends the call down the per-edge path, as the module docstring of new_edges says for any value the JSON text cannot carry.
Notes
- Scope: the JVM wheel. The native wheel sends
new_edgesproperties through its own codec (_native/extras.py) and I did not test it. - A fix is to route the untagged branch through
json_bulk_dumps, which runs the same check as the tagged branch. A timed A/B ofnew_edgeswith properties on 300,000 edges showed no measurable difference.
Activity