Skip to content

OffsetDateTime silently dropped on write (not registered in the type system) - blocks native Bolt datetime writes #4922

Closed

Description

@lvca

Summary

A java.time.OffsetDateTime value is silently dropped when written to a schemaless property. The type system does not recognize OffsetDateTime, so Type.getTypeByValue(offsetDateTime) returns null and the serializer stores nothing - the property comes back as null on read, with no error.

final MutableDocument doc = db.newDocument("Ev");
doc.set("ts", OffsetDateTime.now());   // silently lost
doc.save();
// SELECT ts FROM Ev  ->  ts is null

Why it matters (Bolt / graphiti)

The Neo4j Bolt drivers pack a fixed-offset/UTC datetime (e.g. Python's datetime.now(timezone.utc)) as an offset DateTime PackStream struct, which ArcadeDB decodes (#4905) to a java.time.OffsetDateTime. So every native datetime a graphiti-style client writes over Bolt is currently dropped once it stops sending ISO strings. This blocks the native-datetime write path enabled by #4905 / #4907.

Root cause

OffsetDateTime is registered nowhere in the temporal-type plumbing, even though its siblings are:

  • Type.TYPES_BY_USERTYPE maps Date / Calendar / LocalDateTime / ZonedDateTime / Instant to DATETIME, but not OffsetDateTime.
  • Type.DATETIME (and DATETIME_MICROS/NANOS/SECOND) allowAssignmentFrom lists omit OffsetDateTime.
  • BinaryTypes.getTypeFromValue() has instanceof branches for LocalDateTime / ZonedDateTime / Instant / LocalDate / Date / Calendar, but not OffsetDateTime, so it falls through and the value is not serialized as a datetime.

DateUtils.dateTimeToTimestamp() already handles OffsetDateTime (and isDate() includes it), so only the type-resolution layer is missing.

Fix

Register OffsetDateTime alongside the other temporal types:

  • add it to TYPES_BY_USERTYPE -> DATETIME,
  • add it to the allowAssignmentFrom of DATETIME / DATETIME_MICROS / DATETIME_NANOS / DATETIME_SECOND,
  • add an OffsetDateTime branch to BinaryTypes.getTypeFromValue() (mirroring ZonedDateTime).

Storage normalizes to an instant as it does for ZonedDateTime (zone/offset not preserved; instant is). Comparisons still work because a stored datetime read back as LocalDateTime is treated as UTC by CypherDateTime.compareTo.

Test plan

  • Engine: Type.getTypeByValue(OffsetDateTime) resolves to DATETIME; an OffsetDateTime written to a schemaless property is persisted with the instant preserved.
  • Bolt IT: a native offset datetime sent as a query parameter is stored and read back (previously null).

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions