Piotr Sarna created CASSANDRA-14377:
---------------------------------------

             Summary: Returning invalid JSON for NaN and Infinity float values
                 Key: CASSANDRA-14377
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14377
             Project: Cassandra
          Issue Type: Bug
          Components: CQL
            Reporter: Piotr Sarna


After inserting special float values like NaN and Infinity into a table:

{{CREATE TABLE testme (t1 bigint, t2 float, t3 float, PRIMARY KEY (t1));}}
{{INSERT INTO testme (t1, t2, t3) VALUES (7, NaN, Infinity);}}

and returning them as JSON...

{{cqlsh:demodb> select json * from testme;}}
{{ [json]}}
{{--------------------------------------}}
{{ \{"t1": 7, "t2": NaN, "t3": Infinity}}}

 

... the result will not be validated (e.g. with 
[https://jsonlint.com/|https://jsonlint.com/)] ) because neither NaN nor 
Infinity is a valid JSON value. The consensus seems to be returning JSON's 
`null` in these cases, based on this article 
[https://stackoverflow.com/questions/1423081/json-left-out-infinity-and-nan-json-status-in-ecmascript]
 and other similar ones.



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

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

Reply via email to