You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JVM wheel: Result.to_json() writes a DATE and a DATETIME of a projection row differently from its own record rows and from the native wheel #453
On the JVM wheel the same DATE or DATETIME has two JSON forms in Result.to_json(), depending on whether the row is a record or a projection. On the native wheel it has one. The probe behind #446 gave, for a row with a DATE and a DATETIME:
So the JVM wheel writes a projection DATE as epoch milliseconds (the record row has days) and a projection DATETIME as a text without the milliseconds (the record row has epoch milliseconds, ...678). The native wheel gives the same value for both kinds of row. Anything that reads to_json() and then switches between SELECT * and SELECT a, b on the JVM wheel gets a different unit or type for the same column.
What I would do: make the projection row of the JVM wheel the same as the record row, which is also what the native wheel does. I have not read where the JVM wheel writes the projection (the glue or the engine's JSON writer), so I do not know yet which side the fix goes in. The golden test then pins the projection case too (today it pins only the record row, where the wheels agree).
Refs #314 (item 3 of the status comment of 2026-11-22).
I traced where the two forms come from. It is the engine, not this repository: Result.to_json() of the JVM wheel is str(self._java_result.toJSON()) (src/arcadedb/results.py), and no Java file in src/java/ writes the JSON of a result. Read at the tag 26.11.1 of ArcadeData/arcadedb (the same methods on main at d6b48767cb84):
A record row (SELECT FROM ...) goes through getElement().get().toJSON() and JsonSerializer.map2json. A DATE column becomes epoch days (20455), other temporals epoch milliseconds (1767323045678).
A projection row (SELECT day, ts ...) is a non-element ResultInternal. Its toJSON() calls Result.valueToJSON per property. A LocalDateTime is formatted with the schema's date-time format ("2026-01-02 03:04:05", the milliseconds are gone), and a LocalDate has no branch, so JSONObject writes the epoch milliseconds of its UTC midnight (1767312000000).
Upstream issues ArcadeData/arcadedb#9037 and #9810 deal with this writer, and tests/test_temporal_writers_agree.py says the bridge keeps no encoder of its own, so I do not want to patch the text in Python for the DATE and DATETIME of the top level only (it would leave a DATETIME inside a list or map, and DATETIME_MICROS and DATETIME_NANOS columns, different anyway). The fix belongs in Result.valueToJSON, where both wheels would get it after an engine release. The native wheel writes the record form for both kinds of row with its own codec, so it is the JVM wheel that follows the engine here.
Decision: this is not a regression and it needs an engine change, so I moved it from 26.12.1 to 27.1.1. The next step is an upstream issue with a Java repro on the engine API (two rows, the probe table of #446) that proposes the record form for a projection, for the maintainers to decide. Until then the to_json() docstring says the two forms exist, and the golden test pins only the record row.
I filed the question upstream with a Java repro on the engine API (JDK 21 and 25, engine 26.11.1): ArcadeData/arcadedb#13129. It asks whether a projection row should write a DATE and a DATETIME the way the record row does, and offers a patch for Result.valueToJSON if the answer is yes. This issue stays in 27.1.1 until they answer.
The question to settle before 26.12.1 (2026-12-02): should Result.to_json() of a projection row on arcadedb-jvm stay as it is for this release (option A, my recommendation), or change now (option B)? I reproduced the difference on main and changed nothing, because every change of the output would alter what the to_json() docstring of arcadedb-jvm has described since 26.11.1.
One row, day = 2026-01-02, ts = 2026-01-02 03:04:05.678, SELECT n, day, ts FROM T:
What to_json() returned for each value (DATETIME_MICROS holds .678901). A map holds the same values as a list, and SELECT *, 1 AS one writes the same values as the other SQL projection. to_json_list() returns the same values on both builds for the two SQL row shapes (epoch milliseconds).
Route
Build
DATE
DATETIME
DATETIME_MICROS
DATE in a list
DATETIME in a list
SQL record row (SELECT FROM T)
arcadedb-jvm
20455
1767323045678
"2026-01-02 03:04:05.678901"
1767312000000
1767323045678
SQL record row (SELECT FROM T)
arcadedb
20455
1767323045678
1767323045678
1767312000000
1767323045678
SQL projection (SELECT day, ts, ... FROM T)
arcadedb-jvm
1767312000000
"2026-01-02 03:04:05"
"2026-01-02 03:04:05"
1767312000000
"2026-01-02 03:04:05"
SQL projection (SELECT day, ts, ... FROM T)
arcadedb
20455
1767323045678
1767323045678
1767312000000
1767323045678
openCypher RETURN t.day, t.ts, ...
arcadedb-jvm
"2026-01-02"
"2026-01-02T03:04:05.678"
"2026-01-02T03:04:05.678901"
1767312000000
1767323045678
openCypher RETURN t.day, t.ts, ...
arcadedb
"2026-01-02"
"2026-01-02T03:04:05.678"
"2026-01-02T03:04:05.678901"
1767312000000
1767323045678
Two things go beyond the first report. An openCypher RETURN writes ISO text for a top-level value on both builds, so it is a third form that a change to the SQL projection would not touch. And a DATETIME_MICROS column of a record row also differs: arcadedb-jvm keeps the microseconds as text, arcadedb writes milliseconds.
What the docs say
Where
What it says
Holds today?
to_json() docstring, arcadedb-jvm (src/arcadedb/results.py, released since 26.11.1)
a projection DATE is epoch milliseconds and a projection DATETIME is text in the schema's date-time format; a record row has epoch days and milliseconds (text for microsecond columns)
yes for the SQL rows, not for openCypher
how-to/databases-and-queries.adoc (on main since #469)
"the values in it are the same on both builds"
no: DATE and DATETIME of a SQL projection, and DATETIME_MICROS of a record row and a SQL projection
to_json() on arcadedb
no docstring
Options
What changes
arcadedb-jvm projection after it
Cost
A
Correct the how-to sentence and name the differences. No output changes. The engine question stays open in ArcadeData/arcadedb#13129.
The bindings rewrite the projection row of arcadedb-jvm to the record form now.
{"n":0,"day":20455,"ts":1767323045678}
A caller who reads a projection DATE as milliseconds gets a number 86,400,000 times smaller, with no error, and a DATETIME turns from text into a number. The bindings get a JSON writer of their own (tests/test_temporal_writers_agree.py says they keep none), which also has to handle nested values.
C
The engine changes Result.valueToJSON (ArcadeData/arcadedb#13129), and the wheel takes it with the engine.
{"n":0,"day":20455,"ts":1767323045678} if the engine adopts the record form
The same change for callers, decided by the engine maintainers.
I recommend A for 26.12.1, then C if upstream agrees. The upstream issue is in the engine's 26.12.1 milestone, with no reply yet, and valueToJSON on engine main (54f04e8e1812) still writes the old form. If C lands before the release build, the docstrings and the how-to need an update in the same release, and the golden test can then pin the projection row. B would silently change numbers two days before a release. Under A this issue stays in 27.1.1 and only the docs change goes into 26.12.1.
Reproduction and method
Wheels that CI built from main at 0d4b99e6a2 (version 26.12.1.dev0, Linux x86-64, Python 3.12.13 for the table, and the test also on 3.15.0): arcadedb-jvm on engine 26.12.1-SNAPSHOT (d0f3bbbd24), arcadedb on engine 26.11.1 (a3a5d12457). The test fails on arcadedb-jvm and passes on arcadedb:
"""#453: Result.to_json() of one DATE and one DATETIME, record row against projection row.Runs on both wheels. It fails where a projection row writes another value than the record row."""importjsonfromdatetimeimportdate, datetimeimportarcadedbDAYS=20455# 2026-01-02 as days since the epochMS=1767323045678# 2026-01-02T03:04:05.678Z as epoch millisecondsdeftest_projection_row_writes_date_and_datetime_as_the_record_row_does(tmp_path):
witharcadedb.create_database(str(tmp_path/"db")) asdb:
db.command("sql", "CREATE VERTEX TYPE T")
forname, kindin [("n", "LONG"), ("day", "DATE"), ("ts", "DATETIME")]:
db.command("sql", f"CREATE PROPERTY T.{name}{kind}")
db.insert_many(
"T",
[
{
"n": 0,
"day": date(2026, 1, 2),
"ts": datetime(2026, 1, 2, 3, 4, 5, 678000),
}
],
)
record=json.loads(db.query("sql", "SELECT FROM T").first().to_json())
projection=json.loads(
db.query("sql", "SELECT n, day, ts FROM T").first().to_json()
)
assert (record["day"], record["ts"]) == (DAYS, MS)
assert (projection["day"], projection["ts"]) == (record["day"], record["ts"])
Run it with uv run --no-project --with "<wheel>" --with pytest python -m pytest test_repro453.py.
Decided on 2026-11-30, as the current decision and open to change: option A. 26.12.1 keeps today's to_json() output on both builds, and the change waits for the engine's answer in ArcadeData/arcadedb#13129 (option C). It rests on the options above: rewriting the projection row in the bindings now (option B) would change the unit of a projection DATE and the type of a projection DATETIME with no error just before the release, and the bindings keep no JSON writer of their own. The docs part of option A is done for 26.12.1: #545 and #546 replaced the how-to sentence that said the values are the same on both builds, with a table of what each build writes. This issue stays in 27.1.1.
Edit: the docs part is already done (#545, #546); the first version said it was still to do.
Activity
tae898 commentedon Nov 22, 2026
I traced where the two forms come from. It is the engine, not this repository:
Result.to_json()of the JVM wheel isstr(self._java_result.toJSON())(src/arcadedb/results.py), and no Java file insrc/java/writes the JSON of a result. Read at the tag26.11.1of ArcadeData/arcadedb (the same methods onmainatd6b48767cb84):SELECT FROM ...) goes throughgetElement().get().toJSON()andJsonSerializer.map2json. A DATE column becomes epoch days (20455), other temporals epoch milliseconds (1767323045678).SELECT day, ts ...) is a non-elementResultInternal. ItstoJSON()callsResult.valueToJSONper property. ALocalDateTimeis formatted with the schema's date-time format ("2026-01-02 03:04:05", the milliseconds are gone), and aLocalDatehas no branch, soJSONObjectwrites the epoch milliseconds of its UTC midnight (1767312000000).Upstream issues ArcadeData/arcadedb#9037 and #9810 deal with this writer, and
tests/test_temporal_writers_agree.pysays the bridge keeps no encoder of its own, so I do not want to patch the text in Python for the DATE and DATETIME of the top level only (it would leave a DATETIME inside a list or map, and DATETIME_MICROS and DATETIME_NANOS columns, different anyway). The fix belongs inResult.valueToJSON, where both wheels would get it after an engine release. The native wheel writes the record form for both kinds of row with its own codec, so it is the JVM wheel that follows the engine here.Decision: this is not a regression and it needs an engine change, so I moved it from 26.12.1 to 27.1.1. The next step is an upstream issue with a Java repro on the engine API (two rows, the probe table of #446) that proposes the record form for a projection, for the maintainers to decide. Until then the
to_json()docstring says the two forms exist, and the golden test pins only the record row.tae898 commentedon Nov 23, 2026
I filed the question upstream with a Java repro on the engine API (JDK 21 and 25, engine 26.11.1): ArcadeData/arcadedb#13129. It asks whether a projection row should write a DATE and a DATETIME the way the record row does, and offers a patch for
Result.valueToJSONif the answer is yes. This issue stays in 27.1.1 until they answer.tae898 commentedon Nov 30, 2026
The question to settle before 26.12.1 (2026-12-02): should
Result.to_json()of a projection row onarcadedb-jvmstay as it is for this release (option A, my recommendation), or change now (option B)? I reproduced the difference onmainand changed nothing, because every change of the output would alter what theto_json()docstring ofarcadedb-jvmhas described since 26.11.1.One row,
day= 2026-01-02,ts= 2026-01-02 03:04:05.678,SELECT n, day, ts FROM T:to_json()of the projection rowarcadedb-jvm{"n":0,"day":1767312000000,"ts":"2026-01-02 03:04:05"}arcadedb{"n":0,"day":20455,"ts":1767323045678}What each route writes today
What
to_json()returned for each value (DATETIME_MICROSholds .678901). A map holds the same values as a list, andSELECT *, 1 AS onewrites the same values as the other SQL projection.to_json_list()returns the same values on both builds for the two SQL row shapes (epoch milliseconds).DATEDATETIMEDATETIME_MICROSDATEin a listDATETIMEin a listSELECT FROM T)arcadedb-jvm204551767323045678"2026-01-02 03:04:05.678901"17673120000001767323045678SELECT FROM T)arcadedb204551767323045678176732304567817673120000001767323045678SELECT day, ts, ... FROM T)arcadedb-jvm1767312000000"2026-01-02 03:04:05""2026-01-02 03:04:05"1767312000000"2026-01-02 03:04:05"SELECT day, ts, ... FROM T)arcadedb204551767323045678176732304567817673120000001767323045678RETURN t.day, t.ts, ...arcadedb-jvm"2026-01-02""2026-01-02T03:04:05.678""2026-01-02T03:04:05.678901"17673120000001767323045678RETURN t.day, t.ts, ...arcadedb"2026-01-02""2026-01-02T03:04:05.678""2026-01-02T03:04:05.678901"17673120000001767323045678Two things go beyond the first report. An openCypher
RETURNwrites ISO text for a top-level value on both builds, so it is a third form that a change to the SQL projection would not touch. And aDATETIME_MICROScolumn of a record row also differs:arcadedb-jvmkeeps the microseconds as text,arcadedbwrites milliseconds.What the docs say
to_json()docstring,arcadedb-jvm(src/arcadedb/results.py, released since 26.11.1)DATEis epoch milliseconds and a projectionDATETIMEis text in the schema's date-time format; a record row has epoch days and milliseconds (text for microsecond columns)how-to/databases-and-queries.adoc(onmainsince #469)DATEandDATETIMEof a SQL projection, andDATETIME_MICROSof a record row and a SQL projectionto_json()onarcadedbOptions
arcadedb-jvmprojection after it{"n":0,"day":1767312000000,"ts":"2026-01-02 03:04:05"}arcadedb-jvmto the record form now.{"n":0,"day":20455,"ts":1767323045678}DATEas milliseconds gets a number 86,400,000 times smaller, with no error, and aDATETIMEturns from text into a number. The bindings get a JSON writer of their own (tests/test_temporal_writers_agree.pysays they keep none), which also has to handle nested values.Result.valueToJSON(ArcadeData/arcadedb#13129), and the wheel takes it with the engine.{"n":0,"day":20455,"ts":1767323045678}if the engine adopts the record formI recommend A for 26.12.1, then C if upstream agrees. The upstream issue is in the engine's 26.12.1 milestone, with no reply yet, and
valueToJSONon enginemain(54f04e8e1812) still writes the old form. If C lands before the release build, the docstrings and the how-to need an update in the same release, and the golden test can then pin the projection row. B would silently change numbers two days before a release. Under A this issue stays in 27.1.1 and only the docs change goes into 26.12.1.Reproduction and method
Wheels that CI built from
mainat0d4b99e6a2(version 26.12.1.dev0, Linux x86-64, Python 3.12.13 for the table, and the test also on 3.15.0):arcadedb-jvmon engine 26.12.1-SNAPSHOT (d0f3bbbd24),arcadedbon engine 26.11.1 (a3a5d12457). The test fails onarcadedb-jvmand passes onarcadedb:Run it with
uv run --no-project --with "<wheel>" --with pytest python -m pytest test_repro453.py.docs(#453): to_json() does not write every date and time alike on the…
docs(#453): to_json_list() gives ISO text for a top-level date of an …
tae898 commentedon Nov 30, 2026
Decided on 2026-11-30, as the current decision and open to change: option A. 26.12.1 keeps today's
to_json()output on both builds, and the change waits for the engine's answer in ArcadeData/arcadedb#13129 (option C). It rests on the options above: rewriting the projection row in the bindings now (option B) would change the unit of a projectionDATEand the type of a projectionDATETIMEwith no error just before the release, and the bindings keep no JSON writer of their own. The docs part of option A is done for 26.12.1: #545 and #546 replaced the how-to sentence that said the values are the same on both builds, with a table of what each build writes. This issue stays in 27.1.1.Edit: the docs part is already done (#545, #546); the first version said it was still to do.
tae898 commentedon Nov 30, 2026
I corrected my comment above: the docs part of option A is already done in #545 and #546.