stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
14 stars 16 forks source link

Cassandra `duration` codec does not accept fractional seconds for ISO-8601 input #1626

Open tatu-at-datastax opened 1 week ago

tatu-at-datastax commented 1 week ago

(issue found as part of #1617 / #1619 work)

Codec converting from JSON String input CqlDuration works for most cases: it uses CqlDuration.from(String) which accepts:

  1. Full range of Cassandra's own "compact" (aka "standard" :) ) notation
  2. Regular ISO-8601 P notation
  3. An alternate variation of ISO-8601 "alternate" format (Date-like)

but in case of (2), it does NOT support "Fractional seconds". So whereas

PT10S

(for "10 seconds") is fine,

PT10.450S

(for "10 seconds, 450 milliseconds"0) fails to be decoded.

This is missing from CqlDuration.from(...) implementation (will report).

hemidactylus commented 10 hours ago

Q: will decimals, in the 'seconds' part, be OK even if they come not in triplets, rather according to the minimum needed for expressing? i.e. PT1.4321S.