cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Renato Marroquín Mogrovejo <renatoj.marroq...@gmail.com>
Subject Re: Query column names
Date Wed, 16 Jan 2013 20:46:35 GMT
After searching for a while I found what I was looking for [1]
Hope it helps to someone else (:


Renato M.

[1] http://www.datastax.com/dev/blog/introduction-to-composite-columns-part-1

2013/1/16 Renato Marroquín Mogrovejo <renatoj.marroquin@gmail.com>:
> What I mean is that if there is a way of doing this but using Hector:
>
>
> ---------------------------------------------------------------------------------------------------------------------
> public static void main(String[] args) throws Exception {
> Connector conn = new Connector();
> Cassandra.Client client = conn.connect();
>
> SlicePredicate predicate = new SlicePredicate();
> List<byte[]> colNames = new ArrayList<byte[]>();
> colNames.add("a".getBytes());
> colNames.add("b".getBytes());
> predicate.column_names = colNames;
>
> ColumnParent parent = new ColumnParent("Standard1");
>
> byte[] key = "k1".getBytes();
> List<ColumnOrSuperColumn> results =
> client.get_slice(key, parent, predicate, ConsistencyLevel.ONE);
>
> for (ColumnOrSuperColumn cosc : results) {
> Column c = cosc.column;
> System.out.println(new String(c.name, "UTF-8") + " : "
> + new String(c.value, "UTF-8"));
> }
>
> conn.close();
>
> System.out.println("All done.");
> }
> ---------------------------------------------------------------------------------------------------------------------
>
>
> Thanks!
>
> 2013/1/16 Renato Marroquín Mogrovejo <renatoj.marroquin@gmail.com>:
>> Hi,
>>
>> I am facing some problems while retrieving a some events from a column
>> family. I am using as column family name the event name plus the
>> timestamp of when it occurred.
>> The thing is that now I want to find out the latest event and I don't
>> how to query asking for the last event without a RangeSlicesQuery,
>> getting all rows, and columns, and asking one by one.
>> Is there any other better way of doing this using Hector client?
>>
>> [default@clickstream] list click_event;
>> -------------------
>> RowKey: 706d63666164696e3a31396132613664322d633730642d343139362d623638642d396663663638343766333563
>> => (column=start:2013-01-13 18:14:59.244, value=, timestamp=1358118943979000)
>> => (column=stop:2013-01-13 18:15:56.793,
>> value=323031332d30312d31332031383a31353a35382e333437,
>> timestamp=1358118960946000)
>>
>> Thanks in advance!
>>
>>
>> Renato M.

Mime
View raw message