Search in sources :

Example 66 with DeserializationException

use of org.apache.hadoop.hbase.exceptions.DeserializationException in project hbase by apache.

the class MultipleColumnPrefixFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link MultipleColumnPrefixFilter} instance
 * @return An instance of {@link MultipleColumnPrefixFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static MultipleColumnPrefixFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.MultipleColumnPrefixFilter proto;
    try {
        proto = FilterProtos.MultipleColumnPrefixFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    int numPrefixes = proto.getSortedPrefixesCount();
    byte[][] prefixes = new byte[numPrefixes][];
    for (int i = 0; i < numPrefixes; ++i) {
        prefixes[i] = proto.getSortedPrefixes(i).toByteArray();
    }
    return new MultipleColumnPrefixFilter(prefixes);
}
Also used : InvalidProtocolBufferException(org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException) FilterProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos) DeserializationException(org.apache.hadoop.hbase.exceptions.DeserializationException)

Example 67 with DeserializationException

use of org.apache.hadoop.hbase.exceptions.DeserializationException in project hbase by apache.

the class FuzzyRowFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
 * @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static FuzzyRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.FuzzyRowFilter proto;
    try {
        proto = FilterProtos.FuzzyRowFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    int count = proto.getFuzzyKeysDataCount();
    ArrayList<Pair<byte[], byte[]>> fuzzyKeysData = new ArrayList<>(count);
    for (int i = 0; i < count; ++i) {
        BytesBytesPair current = proto.getFuzzyKeysData(i);
        byte[] keyBytes = current.getFirst().toByteArray();
        byte[] keyMeta = current.getSecond().toByteArray();
        fuzzyKeysData.add(new Pair<>(keyBytes, keyMeta));
    }
    return new FuzzyRowFilter(fuzzyKeysData);
}
Also used : BytesBytesPair(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BytesBytesPair) InvalidProtocolBufferException(org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException) ArrayList(java.util.ArrayList) FilterProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos) DeserializationException(org.apache.hadoop.hbase.exceptions.DeserializationException) BytesBytesPair(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BytesBytesPair) Pair(org.apache.hadoop.hbase.util.Pair)

Example 68 with DeserializationException

use of org.apache.hadoop.hbase.exceptions.DeserializationException in project hbase by apache.

the class MultiRowRangeFilter method parseFrom.

/**
 * @param pbBytes A pb serialized instance
 * @return An instance of MultiRowRangeFilter
 * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
 */
public static MultiRowRangeFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.MultiRowRangeFilter proto;
    try {
        proto = FilterProtos.MultiRowRangeFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    int length = proto.getRowRangeListCount();
    List<FilterProtos.RowRange> rangeProtos = proto.getRowRangeListList();
    List<RowRange> rangeList = new ArrayList<>(length);
    for (FilterProtos.RowRange rangeProto : rangeProtos) {
        RowRange range = new RowRange(rangeProto.hasStartRow() ? rangeProto.getStartRow().toByteArray() : null, rangeProto.getStartRowInclusive(), rangeProto.hasStopRow() ? rangeProto.getStopRow().toByteArray() : null, rangeProto.getStopRowInclusive());
        rangeList.add(range);
    }
    return new MultiRowRangeFilter(rangeList);
}
Also used : InvalidProtocolBufferException(org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException) ArrayList(java.util.ArrayList) FilterProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos) DeserializationException(org.apache.hadoop.hbase.exceptions.DeserializationException)

Example 69 with DeserializationException

use of org.apache.hadoop.hbase.exceptions.DeserializationException in project hbase by apache.

the class SingleColumnValueFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link SingleColumnValueFilter} instance
 * @return An instance of {@link SingleColumnValueFilter} made from <code>bytes</code>
 * @throws org.apache.hadoop.hbase.exceptions.DeserializationException
 * @see #toByteArray
 */
public static SingleColumnValueFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.SingleColumnValueFilter proto;
    try {
        proto = FilterProtos.SingleColumnValueFilter.parseFrom(pbBytes);
    } catch (InvalidProtocolBufferException e) {
        throw new DeserializationException(e);
    }
    final CompareOperator compareOp = CompareOperator.valueOf(proto.getCompareOp().name());
    final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
    try {
        comparator = ProtobufUtil.toComparator(proto.getComparator());
    } catch (IOException ioe) {
        throw new DeserializationException(ioe);
    }
    return new SingleColumnValueFilter(proto.hasColumnFamily() ? proto.getColumnFamily().toByteArray() : null, proto.hasColumnQualifier() ? proto.getColumnQualifier().toByteArray() : null, compareOp, comparator, proto.getFilterIfMissing(), proto.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 70 with DeserializationException

use of org.apache.hadoop.hbase.exceptions.DeserializationException in project hbase by apache.

the class ValueFilter method parseFrom.

/**
 * @param pbBytes A pb serialized {@link ValueFilter} instance
 * @return An instance of {@link ValueFilter} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray
 */
public static ValueFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
    FilterProtos.ValueFilter proto;
    try {
        proto = FilterProtos.ValueFilter.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 ValueFilter(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)

Aggregations

DeserializationException (org.apache.hadoop.hbase.exceptions.DeserializationException)83 IOException (java.io.IOException)57 InvalidProtocolBufferException (org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException)15 FilterProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.FilterProtos)13 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)12 KeeperException (org.apache.zookeeper.KeeperException)12 ArrayList (java.util.ArrayList)11 ServerName (org.apache.hadoop.hbase.ServerName)9 Cell (org.apache.hadoop.hbase.Cell)8 CompareOperator (org.apache.hadoop.hbase.CompareOperator)8 InterruptedIOException (java.io.InterruptedIOException)7 CellVisibility (org.apache.hadoop.hbase.security.visibility.CellVisibility)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 Tag (org.apache.hadoop.hbase.Tag)6 HBaseProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos)6 Map (java.util.Map)5 HBaseIOException (org.apache.hadoop.hbase.HBaseIOException)5 TableName (org.apache.hadoop.hbase.TableName)5 FilterList (org.apache.hadoop.hbase.filter.FilterList)5 List (java.util.List)4