Search in sources :

Example 11 with CompareOperator

use of org.apache.hadoop.hbase.CompareOperator in project hbase by apache.

the class QualifierFilter method createFilterFromArguments.

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments) {
    ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
    CompareOperator compareOp = (CompareOperator) arguments.get(0);
    ByteArrayComparable comparator = (ByteArrayComparable) arguments.get(1);
    return new QualifierFilter(compareOp, comparator);
}
Also used : CompareOperator(org.apache.hadoop.hbase.CompareOperator)

Example 12 with CompareOperator

use of org.apache.hadoop.hbase.CompareOperator in project hbase by apache.

the class RowFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link RowFilter} instance
 * @return An instance of {@link RowFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static RowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.RowFilter proto;
    try {
        proto = FilterProtos.RowFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    final CompareOperator valueCompareOp = CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
    ByteArrayComparable valueComparator = null;
    try {
        if (proto.getCompareFilter().hasComparator()) {
            valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
        }
    } catch (IOException ioe) {
        throw new DeserializationException(ioe);
    }
    return new RowFilter(valueCompareOp, valueComparator);
}
Also used : CompareOperator(org.apache.hadoop.hbase.CompareOperator) InvalidProtocolBufferException(org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException) FilterProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos) IOException(java.io.IOException) DeserializationException(org.apache.hadoop.hbase.exceptions.DeserializationException)

Example 13 with CompareOperator

use of org.apache.hadoop.hbase.CompareOperator in project hbase by apache.

the class RowFilter method createFilterFromArguments.

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments) {
    // for arguments
    @SuppressWarnings("rawtypes") ArrayList arguments = CompareFilter.extractArguments(filterArguments);
    CompareOperator compareOp = (CompareOperator) arguments.get(0);
    ByteArrayComparable comparator = (ByteArrayComparable) arguments.get(1);
    return new RowFilter(compareOp, comparator);
}
Also used : CompareOperator(org.apache.hadoop.hbase.CompareOperator) ArrayList(java.util.ArrayList)

Example 14 with CompareOperator

use of org.apache.hadoop.hbase.CompareOperator in project hbase by apache.

the class SingleColumnValueExcludeFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link SingleColumnValueExcludeFilter} instance
 * @return An instance of {@link SingleColumnValueExcludeFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static SingleColumnValueExcludeFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.SingleColumnValueExcludeFilter proto;
    try {
        proto = FilterProtos.SingleColumnValueExcludeFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    FilterProtos.SingleColumnValueFilter parentProto = proto.getSingleColumnValueFilter();
    final CompareOperator compareOp = CompareOperator.valueOf(parentProto.getCompareOp().name());
    final ByteArrayComparable comparator;
    try {
        comparator = ProtobufUtil.toComparator(parentProto.getComparator());
    } catch (IOException ioe) {
        throw new DeserializationException(ioe);
    }
    return new SingleColumnValueExcludeFilter(parentProto.hasColumnFamily() ? parentProto.getColumnFamily().toByteArray() : null, parentProto.hasColumnQualifier() ? parentProto.getColumnQualifier().toByteArray() : null, compareOp, comparator, parentProto.getFilterIfMissing(), parentProto.getLatestVersionOnly());
}
Also used : CompareOperator(org.apache.hadoop.hbase.CompareOperator) InvalidProtocolBufferException(org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException) FilterProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos) IOException(java.io.IOException) DeserializationException(org.apache.hadoop.hbase.exceptions.DeserializationException)

Example 15 with CompareOperator

use of org.apache.hadoop.hbase.CompareOperator in project hbase by apache.

the class FamilyFilter method createFilterFromArguments.

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments) {
    ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
    CompareOperator compareOp = (CompareOperator) arguments.get(0);
    ByteArrayComparable comparator = (ByteArrayComparable) arguments.get(1);
    return new FamilyFilter(compareOp, comparator);
}
Also used : CompareOperator(org.apache.hadoop.hbase.CompareOperator)

Aggregations

CompareOperator (org.apache.hadoop.hbase.CompareOperator)19 IOException (java.io.IOException)8 DeserializationException (org.apache.hadoop.hbase.exceptions.DeserializationException)8 FilterProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos)8 InvalidProtocolBufferException (org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException)8 ArrayList (java.util.ArrayList)5 Cell (org.apache.hadoop.hbase.Cell)2 Get (org.apache.hadoop.hbase.client.Get)2 Scan (org.apache.hadoop.hbase.client.Scan)2 ByteArrayComparable (org.apache.hadoop.hbase.filter.ByteArrayComparable)2 Filter (org.apache.hadoop.hbase.filter.Filter)2 TimeRange (org.apache.hadoop.hbase.io.TimeRange)2 FilterList (org.apache.gora.filter.FilterList)1 MapFieldValueFilter (org.apache.gora.filter.MapFieldValueFilter)1 SingleFieldValueFilter (org.apache.gora.filter.SingleFieldValueFilter)1 HBaseColumn (org.apache.gora.hbase.store.HBaseColumn)1 ByteBufferExtendedCell (org.apache.hadoop.hbase.ByteBufferExtendedCell)1 CheckAndMutateResult (org.apache.hadoop.hbase.client.CheckAndMutateResult)1 Mutation (org.apache.hadoop.hbase.client.Mutation)1 Put (org.apache.hadoop.hbase.client.Put)1