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

Investigate handling of negative CQL `duration` values, handling #1647

Open tatu-at-datastax opened 14 hours ago

tatu-at-datastax commented 14 hours ago

Apparently (see f.ex https://docs.datastax.com/en/drivers/java/4.4/com/datastax/oss/driver/api/core/data/CqlDuration.html) CQL CqlDuration values can be negative. This is not something ISO-8601 supports it seems (https://en.wikipedia.org/wiki/ISO_8601#Durations).

So, need to investigate how handling works, if users insert negative duration values via CQL (or Data API using C* duration syntax), what should we do on output path?

  1. Throw an exception for invalid value (Codec failing)?
  2. Product special value to indicate issue?

or something else?

tatu-at-datastax commented 12 hours ago

Looks like CqlDuration accepts leading - for its own "compact"/"standard" format AND ISO-8601 (non-standard but whatever), so it may be quite simple to support such values.