You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Hefeng Yuan <hf...@rhapsody.com> on 2011/07/22 23:18:37 UTC

CQL COUNT Not Accurate?

Hi,

I just noticed that the count(*) in CQL seems to be having wrong answer, when I have only one row, the count(*) returns two.

Below are the commands I tried:

cqlsh> SELECT COUNT(*) FROM UserProfile USING CONSISTENCY QUORUM WHERE KEY IN ('00D760DB1730482D81BC6845F875A97D');
(2,)
cqlsh> select * from UserProfile where key = '00D760DB1730482D81BC6845F875A97D';
u'00D760DB1730482D81BC6845F875A97D' | u'ScreenName','3D5C78CAE2E143FBBD1F539A8496D472'

Is this a known bug? Or I did something wrong?

Thanks,
Hefeng

Re: CQL COUNT Not Accurate?

Posted by Eric Evans <ee...@rackspace.com>.
On Fri, 2011-07-22 at 14:18 -0700, Hefeng Yuan wrote:
> Hi,
> 
> I just noticed that the count(*) in CQL seems to be having wrong answer, when I have only one row, the count(*) returns two.
> 
> Below are the commands I tried:
> 
> cqlsh> SELECT COUNT(*) FROM UserProfile USING CONSISTENCY QUORUM WHERE KEY IN ('00D760DB1730482D81BC6845F875A97D');
> (2,)
> cqlsh> select * from UserProfile where key = '00D760DB1730482D81BC6845F875A97D';
> u'00D760DB1730482D81BC6845F875A97D' | u'ScreenName','3D5C78CAE2E143FBBD1F539A8496D472'
> 
> Is this a known bug? Or I did something wrong?

It's the equivalent of get_count(), so it returns a column count instead
of row count.

-- 
Eric Evans
eevans@rackspace.com


Re: CQL COUNT Not Accurate?

Posted by Jonathan Ellis <jb...@gmail.com>.
Yes, this is broken.  We'll fix this for
https://issues.apache.org/jira/browse/CASSANDRA-2474

On Fri, Jul 22, 2011 at 4:18 PM, Hefeng Yuan <hf...@rhapsody.com> wrote:
> Hi,
>
> I just noticed that the count(*) in CQL seems to be having wrong answer, when I have only one row, the count(*) returns two.
>
> Below are the commands I tried:
>
> cqlsh> SELECT COUNT(*) FROM UserProfile USING CONSISTENCY QUORUM WHERE KEY IN ('00D760DB1730482D81BC6845F875A97D');
> (2,)
> cqlsh> select * from UserProfile where key = '00D760DB1730482D81BC6845F875A97D';
> u'00D760DB1730482D81BC6845F875A97D' | u'ScreenName','3D5C78CAE2E143FBBD1F539A8496D472'
>
> Is this a known bug? Or I did something wrong?
>
> Thanks,
> Hefeng



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