You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Kristoffer Sjögren <st...@gmail.com> on 2013/07/06 17:15:03 UTC

Filters and versions

Hi

Im writing a custom filter it seems that filterKeyValue(KeyValue kv) give
me every version, which is fine, but im only interested in the latest
version.

I have tried KeyValue.isLatestTimestamp() to filter out older versions but
this method always returns false?

Also tried setMaxVersions(1) on the Scanner but this doesnt seem to help.

Any advice?

Cheers,
-Kristoffer

Re: Filters and versions

Posted by Kristoffer Sjögren <st...@gmail.com>.
Ah, the latest version is always returned first. Great, thanks Ted!

Cheers,
-Kristoffer


On Sat, Jul 6, 2013 at 5:25 PM, Ted Yu <yu...@gmail.com> wrote:

> Take a look at SingleColumnValueFilter#filterKeyValue() which respects flag
> latestVersionOnly.
>
> Cheers
>
> On Sat, Jul 6, 2013 at 8:15 AM, Kristoffer Sjögren <st...@gmail.com>
> wrote:
>
> > Hi
> >
> > Im writing a custom filter it seems that filterKeyValue(KeyValue kv) give
> > me every version, which is fine, but im only interested in the latest
> > version.
> >
> > I have tried KeyValue.isLatestTimestamp() to filter out older versions
> but
> > this method always returns false?
> >
> > Also tried setMaxVersions(1) on the Scanner but this doesnt seem to help.
> >
> > Any advice?
> >
> > Cheers,
> > -Kristoffer
> >
>

Re: Filters and versions

Posted by Ted Yu <yu...@gmail.com>.
Take a look at SingleColumnValueFilter#filterKeyValue() which respects flag
latestVersionOnly.

Cheers

On Sat, Jul 6, 2013 at 8:15 AM, Kristoffer Sjögren <st...@gmail.com> wrote:

> Hi
>
> Im writing a custom filter it seems that filterKeyValue(KeyValue kv) give
> me every version, which is fine, but im only interested in the latest
> version.
>
> I have tried KeyValue.isLatestTimestamp() to filter out older versions but
> this method always returns false?
>
> Also tried setMaxVersions(1) on the Scanner but this doesnt seem to help.
>
> Any advice?
>
> Cheers,
> -Kristoffer
>