CQL encoding is incorrect for NaN and Infinity floats

Description

This was opened on GitHub issues while we had them open for CLAs:
---------------------------------------------------------------------------------------------
I am using numpy and cqlengine. My model has Float columns, but when I do:
MyModel.create(my_float=numpy.nan)
I recieve:
InvalidRequest: code=2200 [Invalid query] message="unable to coerce 'nan' to a double"
similarly if I do:
MyModel.create(my_float=numpy.inf)` ` orMyModel.create(my_float=float('inf'))
I get:
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:150 no viable alternative at input ')' (... VALUES (ba9424e0-0e6b-49d9-a18a-8fd340216ed5, 1427971488046, [inf]))">
These values are supported for CQL as literals NAN and INFINITY.
---------------------------------------------------------------------------------------------

CQL encoding is incorrect for these values (python string representation for these values do not align with CQL).

Environment

None

Pull Requests

None

Activity

Show:
Greg Bestland
October 22, 2015, 4:29 PM

Added doxygen comments for integration tests. Moving to complete.

Michael Penick
October 20, 2015, 4:59 PM

+1 code review.

Adam Holmberg
October 14, 2015, 4:33 PM

Also found a small cqlsh issue while deving this: https://issues.apache.org/jira/browse/CASSANDRA-10523

Adam Holmberg
October 14, 2015, 4:27 PM
Fixed

Assignee

Unassigned

Reporter

Adam Holmberg

Fix versions

Reviewer

Michael Penick