Search in sources :

Example 1 with SimpleMutableByteRange

use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.

the class VisibilityUtils method createVisibilityLabelFilter.

public static Filter createVisibilityLabelFilter(Region region, Authorizations authorizations) throws IOException {
    Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<>();
    for (HColumnDescriptor hcd : region.getTableDesc().getFamilies()) {
        cfVsMaxVersions.put(new SimpleMutableByteRange(hcd.getName()), hcd.getMaxVersions());
    }
    VisibilityLabelService vls = VisibilityLabelServiceManager.getInstance().getVisibilityLabelService();
    Filter visibilityLabelFilter = new VisibilityLabelFilter(vls.getVisibilityExpEvaluator(authorizations), cfVsMaxVersions);
    return visibilityLabelFilter;
}
Also used : HashMap(java.util.HashMap) ByteRange(org.apache.hadoop.hbase.util.ByteRange) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange) HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) Filter(org.apache.hadoop.hbase.filter.Filter) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange)

Example 2 with SimpleMutableByteRange

use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.

the class PrefixTreeEncoder method initializeTagHelpers.

protected void initializeTagHelpers() {
    this.tagsRange = new SimpleMutableByteRange();
    this.tagsDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet() : new ByteRangeTreeSet();
    this.tagsTokenizer = new Tokenizer();
    this.tagsWriter = new ColumnSectionWriter();
}
Also used : ByteRangeHashSet(org.apache.hadoop.hbase.util.byterange.impl.ByteRangeHashSet) ColumnSectionWriter(org.apache.hadoop.hbase.codec.prefixtree.encode.column.ColumnSectionWriter) Tokenizer(org.apache.hadoop.hbase.codec.prefixtree.encode.tokenize.Tokenizer) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange) ByteRangeTreeSet(org.apache.hadoop.hbase.util.byterange.impl.ByteRangeTreeSet)

Example 3 with SimpleMutableByteRange

use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.

the class ByteRangeSet method store.

protected int store(ByteRange bytes) {
    int indexOfNewElement = numUniqueRanges;
    if (uniqueRanges.size() <= numUniqueRanges) {
        uniqueRanges.add(new SimpleMutableByteRange());
    }
    ByteRange storedRange = uniqueRanges.get(numUniqueRanges);
    int neededBytes = numBytes + bytes.getLength();
    byteAppender = ArrayUtils.growIfNecessary(byteAppender, neededBytes, 2 * neededBytes);
    bytes.deepCopyTo(byteAppender, numBytes);
    // this isn't valid yet
    storedRange.set(byteAppender, numBytes, bytes.getLength());
    numBytes += bytes.getLength();
    uniqueIndexByUniqueRange.put(storedRange, indexOfNewElement);
    int newestUniqueIndex = numUniqueRanges;
    ++numUniqueRanges;
    return newestUniqueIndex;
}
Also used : ByteRange(org.apache.hadoop.hbase.util.ByteRange) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange)

Example 4 with SimpleMutableByteRange

use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.

the class TestByteRange method testConstructor.

@Test
public void testConstructor() {
    ByteRange b = new SimpleMutableByteRange(new byte[] { 0, 1, 2 });
    Assert.assertEquals(3, b.getLength());
}
Also used : ByteRange(org.apache.hadoop.hbase.util.ByteRange) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange) Test(org.junit.Test)

Example 5 with SimpleMutableByteRange

use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.

the class TestTreeDepth method testInternal.

protected void testInternal(List<String> inputs, int expectedTreeDepth) {
    Tokenizer builder = new Tokenizer();
    for (String s : inputs) {
        SimpleMutableByteRange b = new SimpleMutableByteRange(Bytes.toBytes(s));
        builder.addSorted(b);
    }
    Assert.assertEquals(1, builder.getRoot().getNodeDepth());
    Assert.assertEquals(expectedTreeDepth, builder.getTreeDepth());
}
Also used : Tokenizer(org.apache.hadoop.hbase.codec.prefixtree.encode.tokenize.Tokenizer) SimpleMutableByteRange(org.apache.hadoop.hbase.util.SimpleMutableByteRange)

Aggregations

SimpleMutableByteRange (org.apache.hadoop.hbase.util.SimpleMutableByteRange)7 ByteRange (org.apache.hadoop.hbase.util.ByteRange)5 HashMap (java.util.HashMap)2 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)2 Get (org.apache.hadoop.hbase.client.Get)2 Scan (org.apache.hadoop.hbase.client.Scan)2 Tokenizer (org.apache.hadoop.hbase.codec.prefixtree.encode.tokenize.Tokenizer)2 Filter (org.apache.hadoop.hbase.filter.Filter)2 FilterList (org.apache.hadoop.hbase.filter.FilterList)2 AccessDeniedException (org.apache.hadoop.hbase.security.AccessDeniedException)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 IOException (java.io.IOException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 Cell (org.apache.hadoop.hbase.Cell)1