cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-6003) CQL: Support NaN and inifinities in Double literals
Date Wed, 20 Nov 2013 00:15:24 GMT

     [ 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)

Mime
View raw message