You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Pekka Enberg (JIRA)" <ji...@apache.org> on 2019/04/03 12:39:00 UTC

[jira] [Created] (CASSANDRA-15075) SELECT JSON generates invalid JSON for the duration type

Pekka Enberg created CASSANDRA-15075:
----------------------------------------

             Summary: SELECT JSON generates invalid JSON for the duration type
                 Key: CASSANDRA-15075
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15075
             Project: Cassandra
          Issue Type: Bug
            Reporter: Pekka Enberg
         Attachments: 0001-Fix-SELECT-JSON-formatting-for-the-duration-type.patch

Currently, Apache Cassandra generates invalid JSON for the "duration" type.

cqlsh> CREATE KEYSPACE ks1 WITH REPLICATION = \{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
 cqlsh> CREATE TABLE ks1.data (id int, d duration, PRIMARY KEY (id));

cqlsh> INSERT INTO ks1.data (id, d) VALUES (1, 6h40m);
 cqlsh> SELECT JSON d FROM ks1.data WHERE id = 1;

[json]
 --------------
 \{"d": 6h40m}

That is, the duration is not quoted and is therefore invalid according to [https://jsonlint.com/,] for example.

 

Fix the problem by quoting the formatted duration type properly:

cqlsh> INSERT INTO ks1.data (id, d) VALUES (1, 6h40m);
 cqlsh> SELECT JSON d FROM ks1.data WHERE id = 1;

[json]
 ----------------
 \{"d": "6h40m"}

(1 rows)

 

The problem is fixed by the following patch:

[^0001-Fix-SELECT-JSON-formatting-for-the-duration-type.patch]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org