You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Matt Hollingsworth <ma...@crabice.com> on 2011/08/11 04:48:52 UTC

double and float in CQL

Hi,

I'm just getting started with CQL, and decided to do a simple test
create/insert/select thing to check that everything was working.  Most
everything seems to work, but it appears that double/floats do not work
properly.  Here's what I did:

test.cql
--------------------------
CREATE KEYSPACE test with strategy_class = 'SimpleStrategy' and
strategy_options:replication_factor=1;

USE test;
CREATE COLUMNFAMILY testvals (
    key varchar PRIMARY KEY,
    value float
   );

INSERT INTO testvals (key,value) VALUES ('k1',341.32355);
SELECT key, value FROM testvals;
--------------------------

The output is this:

cqlsh localhost < scripts/test.cql
 key |    value |
  k1 | @uU-B??? |

Same thing happens when I do value double.  I also tried to do this from the
python driver, gives the same weirdness:
In [2]: import cql
In [3]: con = cql.connect("localhost",keyspace="test")
In [4]: cursor = con.cursor()
In [5]: cursor.execute("SELECT * from testvals")
Out[5]: True
In [6]: for r in cursor: print r
   ...:
[u'k1', '?\xf8\x00\x00\x00\x00\x00\x00']

Any idea what's going on?

Thanks,

-Matt

Re: double and float in CQL

Posted by Matt Hollingsworth <ma...@crabice.com>.
:)  Sure, I'll create one, thanks for the help.

-Matt

On Wed, Aug 10, 2011 at 11:35 PM, Jonathan Ellis <jb...@gmail.com> wrote:

> I wasn't aware that we had the cql driver in the cheese shop :)  It's
> probably of recent vintage, 1.04 is the "next" version.
>
> Can you create a ticket on
> https://issues.apache.org/jira/browse/CASSANDRA and we'll have a look?
>
> On Wed, Aug 10, 2011 at 10:16 PM, Matt Hollingsworth <ma...@crabice.com>
> wrote:
> > Neither actually, I installed the python cql driver with
> > pip install cql
> > and it came with it.  Looks like it's version 1.0.4
> > pip search cql
> > cql                       - Cassandra Query Language driver
> >   INSTALLED: 1.0.4 (latest)
> > Too old?
> > -Matt
> > On Wed, Aug 10, 2011 at 11:11 PM, Jonathan Ellis <jb...@gmail.com>
> wrote:
> >>
> >> Are you using the most recent version of cqlsh from svn, or an old one
> >> shipped with a 0.8 Cassandra release?
> >>
> >> On Wed, Aug 10, 2011 at 9:48 PM, Matt Hollingsworth <ma...@crabice.com>
> >> wrote:
> >> > Hi,
> >> > I'm just getting started with CQL, and decided to do a simple test
> >> > create/insert/select thing to check that everything was working.  Most
> >> > everything seems to work, but it appears that double/floats do not
> work
> >> > properly.  Here's what I did:
> >> > test.cql
> >> > --------------------------
> >> > CREATE KEYSPACE test with strategy_class = 'SimpleStrategy' and
> >> > strategy_options:replication_factor=1;
> >> > USE test;
> >> > CREATE COLUMNFAMILY testvals (
> >> >     key varchar PRIMARY KEY,
> >> >     value float
> >> >    );
> >> > INSERT INTO testvals (key,value) VALUES ('k1',341.32355);
> >> > SELECT key, value FROM testvals;
> >> > --------------------------
> >> > The output is this:
> >> > cqlsh localhost < scripts/test.cql
> >> >  key |    value |
> >> >   k1 | @uU-B??? |
> >> > Same thing happens when I do value double.  I also tried to do this
> from
> >> > the
> >> > python driver, gives the same weirdness:
> >> > In [2]: import cql
> >> > In [3]: con = cql.connect("localhost",keyspace="test")
> >> > In [4]: cursor = con.cursor()
> >> > In [5]: cursor.execute("SELECT * from testvals")
> >> > Out[5]: True
> >> > In [6]: for r in cursor: print r
> >> >    ...:
> >> > [u'k1', '?\xf8\x00\x00\x00\x00\x00\x00']
> >> > Any idea what's going on?
> >> > Thanks,
> >> > -Matt
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Jonathan Ellis
> >> Project Chair, Apache Cassandra
> >> co-founder of DataStax, the source for professional Cassandra support
> >> http://www.datastax.com
> >
> >
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Re: double and float in CQL

Posted by Jonathan Ellis <jb...@gmail.com>.
I wasn't aware that we had the cql driver in the cheese shop :)  It's
probably of recent vintage, 1.04 is the "next" version.

Can you create a ticket on
https://issues.apache.org/jira/browse/CASSANDRA and we'll have a look?

On Wed, Aug 10, 2011 at 10:16 PM, Matt Hollingsworth <ma...@crabice.com> wrote:
> Neither actually, I installed the python cql driver with
> pip install cql
> and it came with it.  Looks like it's version 1.0.4
> pip search cql
> cql                       - Cassandra Query Language driver
>   INSTALLED: 1.0.4 (latest)
> Too old?
> -Matt
> On Wed, Aug 10, 2011 at 11:11 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>>
>> Are you using the most recent version of cqlsh from svn, or an old one
>> shipped with a 0.8 Cassandra release?
>>
>> On Wed, Aug 10, 2011 at 9:48 PM, Matt Hollingsworth <ma...@crabice.com>
>> wrote:
>> > Hi,
>> > I'm just getting started with CQL, and decided to do a simple test
>> > create/insert/select thing to check that everything was working.  Most
>> > everything seems to work, but it appears that double/floats do not work
>> > properly.  Here's what I did:
>> > test.cql
>> > --------------------------
>> > CREATE KEYSPACE test with strategy_class = 'SimpleStrategy' and
>> > strategy_options:replication_factor=1;
>> > USE test;
>> > CREATE COLUMNFAMILY testvals (
>> >     key varchar PRIMARY KEY,
>> >     value float
>> >    );
>> > INSERT INTO testvals (key,value) VALUES ('k1',341.32355);
>> > SELECT key, value FROM testvals;
>> > --------------------------
>> > The output is this:
>> > cqlsh localhost < scripts/test.cql
>> >  key |    value |
>> >   k1 | @uU-B??? |
>> > Same thing happens when I do value double.  I also tried to do this from
>> > the
>> > python driver, gives the same weirdness:
>> > In [2]: import cql
>> > In [3]: con = cql.connect("localhost",keyspace="test")
>> > In [4]: cursor = con.cursor()
>> > In [5]: cursor.execute("SELECT * from testvals")
>> > Out[5]: True
>> > In [6]: for r in cursor: print r
>> >    ...:
>> > [u'k1', '?\xf8\x00\x00\x00\x00\x00\x00']
>> > Any idea what's going on?
>> > Thanks,
>> > -Matt
>> >
>> >
>>
>>
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of DataStax, the source for professional Cassandra support
>> http://www.datastax.com
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: double and float in CQL

Posted by Matt Hollingsworth <ma...@crabice.com>.
Neither actually, I installed the python cql driver with

pip install cql

and it came with it.  Looks like it's version 1.0.4

pip search cql
cql                       - Cassandra Query Language driver
  INSTALLED: 1.0.4 (latest)

Too old?

-Matt

On Wed, Aug 10, 2011 at 11:11 PM, Jonathan Ellis <jb...@gmail.com> wrote:

> Are you using the most recent version of cqlsh from svn, or an old one
> shipped with a 0.8 Cassandra release?
>
> On Wed, Aug 10, 2011 at 9:48 PM, Matt Hollingsworth <ma...@crabice.com>
> wrote:
> > Hi,
> > I'm just getting started with CQL, and decided to do a simple test
> > create/insert/select thing to check that everything was working.  Most
> > everything seems to work, but it appears that double/floats do not work
> > properly.  Here's what I did:
> > test.cql
> > --------------------------
> > CREATE KEYSPACE test with strategy_class = 'SimpleStrategy' and
> > strategy_options:replication_factor=1;
> > USE test;
> > CREATE COLUMNFAMILY testvals (
> >     key varchar PRIMARY KEY,
> >     value float
> >    );
> > INSERT INTO testvals (key,value) VALUES ('k1',341.32355);
> > SELECT key, value FROM testvals;
> > --------------------------
> > The output is this:
> > cqlsh localhost < scripts/test.cql
> >  key |    value |
> >   k1 | @uU-B??? |
> > Same thing happens when I do value double.  I also tried to do this from
> the
> > python driver, gives the same weirdness:
> > In [2]: import cql
> > In [3]: con = cql.connect("localhost",keyspace="test")
> > In [4]: cursor = con.cursor()
> > In [5]: cursor.execute("SELECT * from testvals")
> > Out[5]: True
> > In [6]: for r in cursor: print r
> >    ...:
> > [u'k1', '?\xf8\x00\x00\x00\x00\x00\x00']
> > Any idea what's going on?
> > Thanks,
> > -Matt
> >
> >
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Re: double and float in CQL

Posted by Jonathan Ellis <jb...@gmail.com>.
Are you using the most recent version of cqlsh from svn, or an old one
shipped with a 0.8 Cassandra release?

On Wed, Aug 10, 2011 at 9:48 PM, Matt Hollingsworth <ma...@crabice.com> wrote:
> Hi,
> I'm just getting started with CQL, and decided to do a simple test
> create/insert/select thing to check that everything was working.  Most
> everything seems to work, but it appears that double/floats do not work
> properly.  Here's what I did:
> test.cql
> --------------------------
> CREATE KEYSPACE test with strategy_class = 'SimpleStrategy' and
> strategy_options:replication_factor=1;
> USE test;
> CREATE COLUMNFAMILY testvals (
>     key varchar PRIMARY KEY,
>     value float
>    );
> INSERT INTO testvals (key,value) VALUES ('k1',341.32355);
> SELECT key, value FROM testvals;
> --------------------------
> The output is this:
> cqlsh localhost < scripts/test.cql
>  key |    value |
>   k1 | @uU-B??? |
> Same thing happens when I do value double.  I also tried to do this from the
> python driver, gives the same weirdness:
> In [2]: import cql
> In [3]: con = cql.connect("localhost",keyspace="test")
> In [4]: cursor = con.cursor()
> In [5]: cursor.execute("SELECT * from testvals")
> Out[5]: True
> In [6]: for r in cursor: print r
>    ...:
> [u'k1', '?\xf8\x00\x00\x00\x00\x00\x00']
> Any idea what's going on?
> Thanks,
> -Matt
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com