Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for filters like SingleColumnValueFilter #147

Open
IceMan81 opened this issue Sep 23, 2016 · 1 comment
Open

Support for filters like SingleColumnValueFilter #147

IceMan81 opened this issue Sep 23, 2016 · 1 comment

Comments

@IceMan81
Copy link

IceMan81 commented Sep 23, 2016

Wondering if some of these filters are not implemented because people haven't found the need for it? I find that filters like SingleColumnValueFilter, SkipFilter can be useful.

Also any reason why some of the abstract methods on ScanFilter are package private?

@terensu
Copy link

terensu commented Dec 8, 2016

`package org.hbase.async;

import org.hbase.async.generated.FilterPB;
import org.hbase.async.generated.HBasePB;
import org.jboss.netty.buffer.ChannelBuffer;

public class SingleColumnValueFilter extends ScanFilter {
private static final byte[] NAME = Bytes.UTF8("org.apache.hadoop.hbase.filter.SingleColumnValueFilter");

protected byte[] columnFamily;
protected byte[] columnQualifier;
protected CompareFilter.CompareOp compareOp;
protected BinaryComparator comparator;

public SingleColumnValueFilter(
        byte[] columnFamily, byte[] columnQualifier, CompareFilter.CompareOp compareOp, byte[] value) {
    this.columnFamily = columnFamily;
    this.columnQualifier = columnQualifier;
    this.compareOp = compareOp;
    this.comparator = new BinaryComparator(value);
}

@Override byte[] name() {
    return NAME;
}

@Override byte[] serialize() {
    return FilterPB.SingleColumnValueFilter.newBuilder().setColumnFamily(Bytes.wrap(columnFamily))
            .setColumnQualifier(Bytes.wrap(columnQualifier)).setComparator(comparator.toProtobuf())
            .setCompareOp(HBasePB.CompareType.valueOf(compareOp.name()))
            .setLatestVersionOnly(true)
            .setFilterIfMissing(true)
            .build().toByteArray();
}

@Override void serializeOld(ChannelBuffer buf) {
    //Nothing after hbase 0.94
}

@Override int predictSerializedSize() {
    return 0;//Nothing after hbase 0.94
}

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants