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.
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.