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

2019-11-27 Thread Pekka Enberg (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-15075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16983679#comment-16983679
 ] 

Pekka Enberg commented on CASSANDRA-15075:
--

Looks good to me! -Pekka

> 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
>  Components: CQL/Syntax
>Reporter: Pekka Enberg
>Assignee: Pekka Enberg
>Priority: Normal
> Fix For: 3.11.x, 4.x
>
> 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
(v8.3.4#803005)

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



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

2019-11-27 Thread Marcus Eriksson (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-15075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16983589#comment-16983589
 ] 

Marcus Eriksson commented on CASSANDRA-15075:
-

pushed a [small update and a 
test|https://github.com/krummas/cassandra/commits/marcuse/15075] with tests 
running 
[here|https://circleci.com/workflow-run/242ed896-419d-4f61-9585-2c674168422c]

does it look good to you [~penberg]?

It was way too painful to update json_test.py, so I just added a small 
roundtrip unit test

> 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
>  Components: CQL/Syntax
>Reporter: Pekka Enberg
>Assignee: Pekka Enberg
>Priority: Normal
> Fix For: 3.11.x, 4.x
>
> 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
(v8.3.4#803005)

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



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

2019-11-11 Thread Pekka Enberg (Jira)


[ 
https://issues.apache.org/jira/browse/CASSANDRA-15075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16971572#comment-16971572
 ] 

Pekka Enberg commented on CASSANDRA-15075:
--

Hi Marcus,

I no longer have the development environment, so if you can do the adjustments 
to the fix yourself, that would be much appreciated!

- Pekka

> 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
>  Components: CQL/Syntax
>Reporter: Pekka Enberg
>Assignee: Pekka Enberg
>Priority: Normal
> Fix For: 3.11.x, 4.x
>
> 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
(v8.3.4#803005)

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