Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Possible to delete a specific cell?


Copy link to this message
-
Re: Possible to delete a specific cell?
Hello,

I think you can use HBase org.apache.hadoop.hbase.client.Delete class.
It already supported to delete a specific version in a cell, see
public Delete deleteColumn(byte[] family, byte[] qualifier, long
timestamp) method.

regards!

Yong

On Thu, Mar 7, 2013 at 9:25 PM, Jonathan Natkins <[EMAIL PROTECTED]> wrote:
> For those who care, it turns out that this use case is currently possible,
> just not through the hbase shell:
>
> hbase(main):002:0> scan 'del_test', { VERSIONS => 10 }
> ROW                                           COLUMN+CELL
>
>
>  key                                          column=f1:c1, timestamp=5,
> value=value5
>
>  key                                          column=f1:c1, timestamp=4,
> value=value4
>
>  key                                          column=f1:c1, timestamp=2,
> value=value2
>
>  key                                          column=f1:c1, timestamp=1,
> value=value1
>
> 1 row(s) in 0.0650 seconds
>
> Here's a small program to try it yourself:
> https://gist.github.com/jnatkins/5111513
>
>
>
> On Thu, Mar 7, 2013 at 10:49 AM, Kevin O'dell <[EMAIL PROTECTED]>wrote:
>
>> Ted,
>>
>>  Yes that is correct, sorry 3 is newer than 1 when speak TSs.  Sorry for
>> the confusion :)
>>
>> On Thu, Mar 7, 2013 at 1:48 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
>>
>> > I think there was typo in Kevin's email: t3 should be t1
>> >
>> > On Thu, Mar 7, 2013 at 10:42 AM, Kevin O'dell <[EMAIL PROTECTED]
>> > >wrote:
>> >
>> > > JM,
>> > >
>> > >   If you delete t2, you will also wipe out t3 right now.
>> > >
>> > > On Thu, Mar 7, 2013 at 1:37 PM, Jean-Marc Spaggiari <
>> > > [EMAIL PROTECTED]
>> > > > wrote:
>> > >
>> > > > Kevin,
>> > > >
>> > > > How do you see that? Like a specific cell format which can "cancel"
>> > > > once timestamp and no delete all the previous one?
>> > > >
>> > > > Like before compaction we can have
>> > > >
>> > > > v1:t1
>> > > > v1:t2
>> > > > v1:t3
>> > > > v1:d2 <= Delete only t2 version.
>> > > >
>> > > > And at compaction time we only keep that in mind and give this as a
>> > > result:
>> > > > v1:t1
>> > > > v1:t3
>> > > >
>> > > > ?
>> > > >
>> > > > 2013/3/7 Jeff Kolesky <[EMAIL PROTECTED]>:
>> > > > > Yes, this behavior would be fantastic.  If you follow the Kiji/Wibi
>> > > model
>> > > > > of using many versioned cells, being able to delete a specific cell
>> > > > without
>> > > > > deleting all cells prior to it would be very useful.
>> > > > >
>> > > > > Jeff
>> > > > >
>> > > > >
>> > > > > On Thu, Mar 7, 2013 at 10:26 AM, Kevin O'dell <
>> > > [EMAIL PROTECTED]
>> > > > >wrote:
>> > > > >
>> > > > >> The problem is it kills all older cells.  We should probably file
>> a
>> > > JIRA
>> > > > >> for this, as this behavior would be nice.  Thoughts?:
>> > > > >>
>> > > > >> hbase(main):028:0> truncate 'tre'
>> > > > >>
>> > > > >> Truncating 'tre' table (it may take a while):
>> > > > >>
>> > > > >> - Disabling table...
>> > > > >>
>> > > > >> - Dropping table...
>> > > > >>
>> > > > >> - Creating table...
>> > > > >>
>> > > > >> 0 row(s) in 4.6060 seconds
>> > > > >>
>> > > > >>
>> > > > >> hbase(main):029:0> put 'tre', 'row1', 'cf1:c1', 'abc', 111
>> > > > >>
>> > > > >> 0 row(s) in 0.0220 seconds
>> > > > >>
>> > > > >>
>> > > > >> hbase(main):030:0> put 'tre', 'row1', 'cf1:c1', 'abcd', 112
>> > > > >>
>> > > > >> 0 row(s) in 0.0060 seconds
>> > > > >>
>> > > > >>
>> > > > >> hbase(main):031:0> put 'tre', 'row1', 'cf1:c1', 'abce', 113
>> > > > >>
>> > > > >> 0 row(s) in 0.0120 seconds
>> > > > >>
>> > > > >>
>> > > > >> hbase(main):032:0> scan 'tre', {NAME => 'cf1:c1', VERSIONS => 4}
>> > > > >>
>> > > > >> ROW
>> > >  COLUMN+CELL
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >> row1
>> > > >  column=cf1:c1,
>> > > > >> timestamp=113, value=abce
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >> row1
>> > > >  column=cf1:c1,
>> > > > >> timestamp=112, value=abcd
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >> row1
>> > > >  column=cf1:c1,
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB