cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard grossman <richie...@gmail.com>
Subject Re: Get_slice with super column
Date Wed, 11 Nov 2009 08:07:19 GMT
Hello

Is there someone that can just write some code line here to give a little
sample how to select column when using a super_column
Thanks

Richard

On Tue, Nov 10, 2009 at 9:41 PM, Richard grossman <richiesgr@gmail.com>wrote:

> hi
>
> I insert data like this
>     Calendar calendar = Calendar.getInstance();
>     calendar.setTime(dateAction);
>     calendar.set(Calendar.MILLISECOND, 0);
>     String millis = String.valueOf(calendar.getTimeInMillis());
>
>         ColumnPath columnPath = new ColumnPath(columnFamily,
> millis.getBytes("UTF-8"), ("showId").getBytes("UTF-8"));
>         cassandraClient.insert("Keyspace1", userId, columnPath,
> showId.getBytes("UTF-8"), timestamp, ConsistencyLevel.ONE);
>
>         columnPath = new ColumnPath(columnFamily, millis.getBytes("UTF-8"),
> ("parentShowId").getBytes("UTF-8"));
>         cassandraClient.insert("Keyspace1", userId, columnPath,
> parentShowId.getBytes("UTF-8"), timestamp, ConsistencyLevel.ONE);
>
> As you can see I use a datetime as super_column name.
>
> I want to make get_slice to get only the showId field. I've tried to make
> all the combination to get only this nothing help I get nothing.
> like this
>             col.add("showId".getBytes("UTF-8"));
>             SlicePredicate predicateNegative = new SlicePredicate(col, new
> SliceRange(new byte[0], new byte[0], false, 1000000));
>
> or like this
>             SlicePredicate predicateNegative = new SlicePredicate(null, new
> SliceRange("showId".getBytes(), "showId".getBytes(), false, 1000000));
>
> where is the problem ?
>
> thanks
>

Mime
View raw message