You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2013/11/20 01:15:24 UTC

[jira] [Updated] (CASSANDRA-6003) CQL: Support NaN and inifinities in Double literals

     [ https://issues.apache.org/jira/browse/CASSANDRA-6003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-6003:
--------------------------------------

    Priority: Minor  (was: Major)
      Labels: lhf  (was: )

Should be just a matter of tweaking DoubleType's fromString.  (Does Double.valueOf not understand NaN?)

> CQL: Support NaN and inifinities in Double literals
> ---------------------------------------------------
>
>                 Key: CASSANDRA-6003
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6003
>             Project: Cassandra
>          Issue Type: Wish
>          Components: Core
>            Reporter: Alex Cruise
>            Priority: Minor
>              Labels: lhf
>
> My actual app uses a Map[UUID, Double], and in the upstream data source, unavailable data is encoded as Double.NaN. But when I try to insert them into C* (currently working with 2.0), I get a "no viable alternative" at the syntax immediately following the NaN value. 
> Here's a tiny test case:
> {code}
> cqlsh> create table test (pk timeuuid primary key, d double);
> cqlsh> insert into test (pk, d) values (now(), NaN);
> Bad Request: line 1:43 no viable alternative at input ')'
> {code}
> The workaround suggested by 'iamaleksey' on IRC (Thanks!) allows the data to be inserted, but it's really ugly, and I'm not sure yet whether it will work OK on the read side:
> {code}
> // myStuff is a Map[UUID,Double]
> mySuff.mapValues { 
>   case x if x.isNaN => QueryBuilder.fcall("blobAsDouble", ByteBufferUtil.EMPTY_BYTE_BUFFER) 
>   case x => x: java.lang.Double // explicit boxing, maybe not necessary 
> }.asJava
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)