Repository navigation
Description
Summary
Follow-up to #8158. That issue was about DATETIME_MICROS and DATETIME_NANOS reading back as null when arcadedb.dateTimeImplementation is java.util.Date or java.util.Calendar, and the fix gave those two types a LocalDateTime fallback. DATETIME_SECOND is the fourth arm of the same switch and still passes dateTimeImplementation straight through.
A DATETIME_SECOND column stores epoch SECONDS. The read hands that number to DateUtils.dateTime(..., SECONDS, dateTimeImplementation, SECONDS); convertTimestamp() returns it unchanged because from == to, and the number is then fed to new Date(ms) and Calendar.setTimeInMillis(ms). Both accept it, so nothing throws and the corrupt-property recovery never fires: the read simply answers a timestamp 1000 times too small.
That is worse than the symptom #8158 reported. A null is visible; a plausible wrong date is not.
Where (HEAD 6fefb26)
engine/src/main/java/com/arcadedb/serializer/BinarySerializer.java:847-850, the one arm of the switch still using the raw setting:
case BinaryTypes.TYPE_DATETIME_SECOND:
value = DateUtils.dateTime(database, content.getUnsignedNumber(), ChronoUnit.SECONDS, dateTimeImplementation,
ChronoUnit.SECONDS);reaching engine/src/main/java/com/arcadedb/utility/DateUtils.java:114 and :120:
if (dateTimeImplementation.equals(Date.class)) {
...
value = new Date(convertedTimestamp);
} else if (dateTimeImplementation.equals(Calendar.class)) {
...
((Calendar) value).setTimeInMillis(convertedTimestamp);convertedTimestamp is still in seconds here: convertTimestamp() returns its input unchanged when from == to (DateUtils.java:800).
Repro
One record with a DATETIME_SECOND property dts stored as 2024-02-29 13:45:10, read back under each configured implementation:
LocalDateTime impl: dts=2024-02-29T13:45:10 (correct)
Date impl: dts=Tue Jan 20 19:46:54 WET 1970 (WRONG - 1709214310 read as MILLIS)
Calendar impl: dts=GregorianCalendar[time=1709214310, YEAR=1970, MONTH=0, DAY_OF_MONTH=20, ...] (WRONG)
ZonedDateTime impl: dts=2024-02-29T13:45:10Z[UTC] (correct)
Instant impl: dts=2024-02-29T13:45:10Z (correct)
No exception and no "Skipping corrupted property" warning in the two wrong cases.
Suggested fix
Give DATETIME_SECOND the same treatment #8158 gave DATETIME_MICROS and DATETIME_NANOS: resolve the implementation through the new subMillisDateTimeImplementation field, or convert seconds to milliseconds before handing the value to Date/Calendar. The first keeps the four arms consistent.
Scope / confidence
Measured on a build of today's HEAD, in the same run that confirmed the #8158 fix works for MICROS and NANOS. Pre-existing rather than introduced, but it is the identical sibling site in the same switch that the fix walked past, and it leaves DATETIME_SECOND as the only one of the four datetime types whose answer depends on the configured implementation.
Swept while checking: getDateTimeImplementation() callers outside the serializer are consistent with the new behaviour. RemoteImmutableDocument.java:74 and :214 already apply the setting only to Type.DATETIME and fall back to propType.getDefaultJavaType() for the sub-millisecond types, so the remote client agrees. SQLMethodAsDateTime.java:53, SQLFunctionSysdate and SQLFunctionDate go through DateUtils.getDate(), which takes no precision argument. Only Date.class and Calendar.class exactly can reach these arms, since DateUtils dispatches with .equals and anything else falls to a SerializationException, so there is no subclass gap.
Activity
Merge pull request #8309 from ArcadeData/fix/issues-8261-8258-8254-8253
lvca commentedon Sep 25, 2026
Fixed in #8309, available in 26.10.1.
A
DATETIME_SECONDproperty read back witharcadedb.dateTimeImplementationset tojava.util.Dateorjava.util.Calendaris now converted from seconds to milliseconds first, so it returns the correct date instead of one in January 1970.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(ArcadeData#8253,ArcadeData#8258,ArcadeData#8254,ArcadeData#8261):…