Retrieving data between two timestamps

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving data between two timestamps

Renato Marroquín Mogrovejo
Hi all,

I am having some problems while retrieving some events from a column
family I have created.
My column family has been created as follows:

create column family click_event
  WITH comparator = UTF8Type and
  column_metadata = [ {column_name: event, validation_class: UTF8Type} ];

My table is populated as follows:

 list click_events;
-------------------
=> (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)

I have two questions here:
1) What is the timestamp column used for?
2) How can I retrieve this timestamp column using Hector client?

Thanks in advance!


Renato M.
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving data between two timestamps

Aaron Turner
I don't think so.  Usually you'd use either a Time-UUID or something
like epoch time as the column name to get a range of columns by time
range.

On Tue, Jan 15, 2013 at 10:46 AM, Renato Marroquín Mogrovejo
<[hidden email]> wrote:

> Hi all,
>
> I am having some problems while retrieving some events from a column
> family I have created.
> My column family has been created as follows:
>
> create column family click_event
>   WITH comparator = UTF8Type and
>   column_metadata = [ {column_name: event, validation_class: UTF8Type} ];
>
> My table is populated as follows:
>
>  list click_events;
> -------------------
> => (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)
>
> I have two questions here:
> 1) What is the timestamp column used for?
> 2) How can I retrieve this timestamp column using Hector client?
>
> Thanks in advance!
>
>
> Renato M.



--
Aaron Turner
http://synfin.net/         Twitter: @synfinatic
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin
"carpe diem quam minimum credula postero"
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving data between two timestamps

Renato Marroquín Mogrovejo
Hi Aaron,

Thanks for answering! Yeah that is what I did but then when looking
into the actual column family created I saw this timestamp column
which Cassandra had created. Are we allowed to use this? What is this
specifically for?
Thanks again for the help!


Renato M.

2013/1/15 Aaron Turner <[hidden email]>:

> I don't think so.  Usually you'd use either a Time-UUID or something
> like epoch time as the column name to get a range of columns by time
> range.
>
> On Tue, Jan 15, 2013 at 10:46 AM, Renato Marroquín Mogrovejo
> <[hidden email]> wrote:
>> Hi all,
>>
>> I am having some problems while retrieving some events from a column
>> family I have created.
>> My column family has been created as follows:
>>
>> create column family click_event
>>   WITH comparator = UTF8Type and
>>   column_metadata = [ {column_name: event, validation_class: UTF8Type} ];
>>
>> My table is populated as follows:
>>
>>  list click_events;
>> -------------------
>> => (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)
>>
>> I have two questions here:
>> 1) What is the timestamp column used for?
>> 2) How can I retrieve this timestamp column using Hector client?
>>
>> Thanks in advance!
>>
>>
>> Renato M.
>
>
>
> --
> Aaron Turner
> http://synfin.net/         Twitter: @synfinatic
> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
> Those who would give up essential Liberty, to purchase a little temporary
> Safety, deserve neither Liberty nor Safety.
>     -- Benjamin Franklin
> "carpe diem quam minimum credula postero"
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving data between two timestamps

Aaron Turner
The timestamp is the time the record was inserted into the Cassandra
node.  It's used for conflict resolution, so if two clients insert
different data into the same row/column, Cassandra can pick the
"winner" (most recent timestamp).

You can set it manually on insert, otherwise the node will pick the
current time for you (this is a major reason why you want all your
Cassandra nodes clocks synchronized via NTP by the way).  It's also
available to be read, but I don't recall any API available (Hector or
otherwise) which allows you to search based on the timestamp value.

On Tue, Jan 15, 2013 at 11:51 AM, Renato Marroquín Mogrovejo
<[hidden email]> wrote:

> Hi Aaron,
>
> Thanks for answering! Yeah that is what I did but then when looking
> into the actual column family created I saw this timestamp column
> which Cassandra had created. Are we allowed to use this? What is this
> specifically for?
> Thanks again for the help!
>
>
> Renato M.
>
> 2013/1/15 Aaron Turner <[hidden email]>:
>> I don't think so.  Usually you'd use either a Time-UUID or something
>> like epoch time as the column name to get a range of columns by time
>> range.
>>
>> On Tue, Jan 15, 2013 at 10:46 AM, Renato Marroquín Mogrovejo
>> <[hidden email]> wrote:
>>> Hi all,
>>>
>>> I am having some problems while retrieving some events from a column
>>> family I have created.
>>> My column family has been created as follows:
>>>
>>> create column family click_event
>>>   WITH comparator = UTF8Type and
>>>   column_metadata = [ {column_name: event, validation_class: UTF8Type} ];
>>>
>>> My table is populated as follows:
>>>
>>>  list click_events;
>>> -------------------
>>> => (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)
>>>
>>> I have two questions here:
>>> 1) What is the timestamp column used for?
>>> 2) How can I retrieve this timestamp column using Hector client?
>>>
>>> Thanks in advance!
>>>
>>>
>>> Renato M.
>>
>>
>>
>> --
>> Aaron Turner
>> http://synfin.net/         Twitter: @synfinatic
>> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
>> Those who would give up essential Liberty, to purchase a little temporary
>> Safety, deserve neither Liberty nor Safety.
>>     -- Benjamin Franklin
>> "carpe diem quam minimum credula postero"



--
Aaron Turner
http://synfin.net/         Twitter: @synfinatic
http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    -- Benjamin Franklin
"carpe diem quam minimum credula postero"
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving data between two timestamps

Renato Marroquín Mogrovejo
Thanks for the explanation Aaron!


Renato M.

2013/1/15 Aaron Turner <[hidden email]>:

> The timestamp is the time the record was inserted into the Cassandra
> node.  It's used for conflict resolution, so if two clients insert
> different data into the same row/column, Cassandra can pick the
> "winner" (most recent timestamp).
>
> You can set it manually on insert, otherwise the node will pick the
> current time for you (this is a major reason why you want all your
> Cassandra nodes clocks synchronized via NTP by the way).  It's also
> available to be read, but I don't recall any API available (Hector or
> otherwise) which allows you to search based on the timestamp value.
>
> On Tue, Jan 15, 2013 at 11:51 AM, Renato Marroquín Mogrovejo
> <[hidden email]> wrote:
>> Hi Aaron,
>>
>> Thanks for answering! Yeah that is what I did but then when looking
>> into the actual column family created I saw this timestamp column
>> which Cassandra had created. Are we allowed to use this? What is this
>> specifically for?
>> Thanks again for the help!
>>
>>
>> Renato M.
>>
>> 2013/1/15 Aaron Turner <[hidden email]>:
>>> I don't think so.  Usually you'd use either a Time-UUID or something
>>> like epoch time as the column name to get a range of columns by time
>>> range.
>>>
>>> On Tue, Jan 15, 2013 at 10:46 AM, Renato Marroquín Mogrovejo
>>> <[hidden email]> wrote:
>>>> Hi all,
>>>>
>>>> I am having some problems while retrieving some events from a column
>>>> family I have created.
>>>> My column family has been created as follows:
>>>>
>>>> create column family click_event
>>>>   WITH comparator = UTF8Type and
>>>>   column_metadata = [ {column_name: event, validation_class: UTF8Type} ];
>>>>
>>>> My table is populated as follows:
>>>>
>>>>  list click_events;
>>>> -------------------
>>>> => (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)
>>>>
>>>> I have two questions here:
>>>> 1) What is the timestamp column used for?
>>>> 2) How can I retrieve this timestamp column using Hector client?
>>>>
>>>> Thanks in advance!
>>>>
>>>>
>>>> Renato M.
>>>
>>>
>>>
>>> --
>>> Aaron Turner
>>> http://synfin.net/         Twitter: @synfinatic
>>> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
>>> Those who would give up essential Liberty, to purchase a little temporary
>>> Safety, deserve neither Liberty nor Safety.
>>>     -- Benjamin Franklin
>>> "carpe diem quam minimum credula postero"
>
>
>
> --
> Aaron Turner
> http://synfin.net/         Twitter: @synfinatic
> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows
> Those who would give up essential Liberty, to purchase a little temporary
> Safety, deserve neither Liberty nor Safety.
>     -- Benjamin Franklin
> "carpe diem quam minimum credula postero"