Skip to content

JVM GraphBatch.new_edges: a subnormal float in an edge property is stored as a DECIMAL #420

Open

Description

@shaunpatterson

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_edges properties 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 of new_edges with properties on 300,000 edges showed no measurable difference.

Activity

  1. added
    jvmThe arcadedb-jvm package (JPype build)
    pythonPull requests that update python code
    on Nov 21, 2026
  2. added this to the 26.12.1 milestone on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in progressThe team is actively working on this issuejvmThe arcadedb-jvm package (JPype build)pythonPull requests that update python code

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions