You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Rommel Garcia <gr...@gmail.com> on 2011/03/11 04:28:39 UTC

Secondary Index not working?

I tried the tutorial on this site - http://www.datastax.com/docs/0.7/data_model/secondary_indexes and worked on creating an index on a new column. That went good. But when I indexed an existing column, my query below returns 0 row where in fact it should return 1.

Query:

get users where state = 'GA' and birth_date > 1970;

Here's my Column Family Metadata:
Column Families:
    ColumnFamily: users
      Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
      Row cache size / save period: 0.0/0
      Key cache size / save period: 200000.0/14400
      Memtable thresholds: 0.29062499999999997/62/60
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 1.0
      Built indexes: [users.62697274685f64617465, users.7374617465]
      Column Metadata:
        Column Name: full_name (full_name)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
        Column Name: state (state)
          Validation Class: org.apache.cassandra.db.marshal.UTF8Type
          Index Type: KEYS
        Column Name: birth_date (birth_date)
          Validation Class: org.apache.cassandra.db.marshal.LongType
          Index Type: KEYS

Here's the data set:

RowKey: birt_date
=> (column=birth_date, value=1973, timestamp=1299200995417000)
=> (column=full_name, value=Patrick Rothfuss, timestamp=1299200746636000)
=> (column=state, value=GA, timestamp=1299200968945000)

I'm not sure what I'm missing. Appreciate any help!

Rom




Re: Secondary Index not working?

Posted by Jonathan Ellis <jb...@gmail.com>.
https://issues.apache.org/jira/browse/CASSANDRA-2244

On Thu, Mar 10, 2011 at 9:28 PM, Rommel Garcia <gr...@gmail.com> wrote:
> I tried the tutorial on this site
> - http://www.datastax.com/docs/0.7/data_model/secondary_indexes and worked
> on creating an index on a new column. That went good. But when I indexed an
> existing column, my query below returns 0 row where in fact it should return
> 1.
> Query:
> get users where state = 'GA' and birth_date > 1970;
> Here's my Column Family Metadata:
> Column Families:
>     ColumnFamily: users
>       Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
>       Row cache size / save period: 0.0/0
>       Key cache size / save period: 200000.0/14400
>       Memtable thresholds: 0.29062499999999997/62/60
>       GC grace seconds: 864000
>       Compaction min/max thresholds: 4/32
>       Read repair chance: 1.0
>       Built indexes: [users.62697274685f64617465, users.7374617465]
>       Column Metadata:
>         Column Name: full_name (full_name)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>         Column Name: state (state)
>           Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>           Index Type: KEYS
>         Column Name: birth_date (birth_date)
>           Validation Class: org.apache.cassandra.db.marshal.LongType
>           Index Type: KEYS
> Here's the data set:
> RowKey: birt_date
> => (column=birth_date, value=1973, timestamp=1299200995417000)
> => (column=full_name, value=Patrick Rothfuss, timestamp=1299200746636000)
> => (column=state, value=GA, timestamp=1299200968945000)
> I'm not sure what I'm missing. Appreciate any help!
> Rom
>
>
>



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