Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Set floating point key with couchbase-client-1.1.0.jar

3 replies [Last post]
  • Login or register to post comments
Tue, 12/18/2012 - 09:13
panagiotis
Offline
Joined: 12/18/2012
Groups: None

I am trying to perform a query to a view I created for the beer-sample with the abv values. When I try to set the value to a floating point number (5.2f) using ComplexKey.of(5.2f) the query created is not ?key=5.2 as expected but ?key=%225.2%22.

The reason is the function Query.prepareValue that throws a NumberFormatException when it fails to parse my value as a Long.

My question is why does it try to parse the value as a Long exclusively and does not attempt to parse it as a float.

Thank you,
Panagiotis

Top
  • Login or register to post comments
Wed, 12/19/2012 - 01:48
daschl
Offline
Joined: 05/19/2012
Groups: None

Hi panagiotis,

you're perfectly right, it doesn't work with floats currently - only with doubles. Can you use doubles in the meantime? I'll open an enhancement ticket and make sure it will be in there for the 1.1.1 bugfix release.

Thanks,
Michael

Top
  • Login or register to post comments
Wed, 12/19/2012 - 02:09
panagiotis
Offline
Joined: 12/18/2012
Groups: None

Thank you Michael for the reply,

yes, in fact I could work with doubles but I think that it doesn't work with doubles either.

I tried this
query.setKey(ComplexKey.of(Double.valueOf(5.2)));

and again in Query.prepareValue() a NumberFormatException is thrown when it attempts to parse it as a Long. Am I missing something?

Thanks again,
Panagiotis

Top
  • Login or register to post comments
Wed, 12/19/2012 - 02:18
daschl
Offline
Joined: 05/19/2012
Groups: None

Oh, I'm sorry, yes I meant Longs (you can try the L literal).

I'm going to fix it up for floats and doubles as well. This shouldn't be a large change, so expect it to be in 1.1.1

Thanks!

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker