Package org.apache.hbase.index.util

Examples of org.apache.hbase.index.util.ImmutableBytesPtr


            int count = joinInfo.getJoinIds().length;
            List<Tuple>[] tuples = new List[count];
            Tuple tuple = new ResultTuple(new Result(result));
            boolean cont = true;
            for (int i = 0; i < count; i++) {
                ImmutableBytesPtr key = TupleUtil.getConcatenatedValue(tuple, joinInfo.getJoinExpressions()[i]);
                HashCache hashCache = (HashCache)cache.getServerCache(joinInfo.getJoinIds()[i]);
                tuples[i] = hashCache.get(key);
                JoinType type = joinInfo.getJoinTypes()[i];
                if (type == JoinType.Inner && (tuples[i] == null || tuples[i].isEmpty())) {
                    cont = false;
View Full Code Here


*/
public class ServerCachingEndpointImpl extends BaseEndpointCoprocessor implements ServerCachingProtocol {

    @Override
    public boolean addServerCache(byte[] tenantId, byte[] cacheId, ImmutableBytesWritable cachePtr, ServerCacheFactory cacheFactory) throws SQLException {
        TenantCache tenantCache = GlobalCache.getTenantCache((RegionCoprocessorEnvironment)this.getEnvironment(), tenantId == null ? null : new ImmutableBytesPtr(tenantId));
        tenantCache.addServerCache(new ImmutableBytesPtr(cacheId), cachePtr, cacheFactory);
        return true;
    }
View Full Code Here

                pkValues[pkSlotIndex[i]] = value;
            } else {
                columnValues.put(column, value);
            }
        }
        ImmutableBytesPtr ptr = new ImmutableBytesPtr();
        table.newKey(ptr, pkValues);
        mutation.put(ptr, columnValues);
    }
View Full Code Here

        return true;
    }

    @Override
    public boolean removeServerCache(byte[] tenantId, byte[] cacheId) throws SQLException {
        TenantCache tenantCache = GlobalCache.getTenantCache((RegionCoprocessorEnvironment)this.getEnvironment(), tenantId == null ? null : new ImmutableBytesPtr(tenantId));
        tenantCache.removeServerCache(new ImmutableBytesPtr(cacheId));
        return true;
    }
View Full Code Here

                int count = WritableUtils.readVInt(input);
                Map<ImmutableBytesPtr, byte[]> cfMap = new HashMap<ImmutableBytesPtr, byte[]>();
                for (int i = 0; i < count; i++) {
                    byte[] cf = WritableUtils.readCompressedByteArray(input);
                    byte[] renamed = WritableUtils.readCompressedByteArray(input);
                    cfMap.put(new ImmutableBytesPtr(cf), renamed);
                }
                return new ScanProjector(type, null, cfMap, null);
            }
           
            int count = WritableUtils.readVInt(input);
            Map<ImmutableBytesPtr, Map<ImmutableBytesPtr, Pair<byte[], byte[]>>> cqMap =
                new HashMap<ImmutableBytesPtr, Map<ImmutableBytesPtr, Pair<byte[], byte[]>>>();
            for (int i = 0; i < count; i++) {
                byte[] cf = WritableUtils.readCompressedByteArray(input);
                int nQuals = WritableUtils.readVInt(input);
                Map<ImmutableBytesPtr, Pair<byte[], byte[]>> map =
                    new HashMap<ImmutableBytesPtr, Pair<byte[], byte[]>>();
                for (int j = 0; j < nQuals; j++) {
                    byte[] cq = WritableUtils.readCompressedByteArray(input);
                    byte[] renamedCf = WritableUtils.readCompressedByteArray(input);
                    byte[] renamedCq = WritableUtils.readCompressedByteArray(input);
                    map.put(new ImmutableBytesPtr(cq), new Pair<byte[], byte[]>(renamedCf, renamedCq));
                }
                cqMap.put(new ImmutableBytesPtr(cf), map);
            }
            return new ScanProjector(type, null, null, cqMap);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

            return KeyValueUtil.newKeyValue(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength(),
                    cf, kv.getQualifier(), kv.getTimestamp(), kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
        }
       
        if (type == ProjectionType.CF) {
            byte[] cf = cfProjectionMap.get(new ImmutableBytesPtr(kv.getFamily()));
            if (cf == null)
                return kv;
            return KeyValueUtil.newKeyValue(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength(),
                    cf, kv.getQualifier(), kv.getTimestamp(), kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
        }
       
        Map<ImmutableBytesPtr, Pair<byte[], byte[]>> map = cqProjectionMap.get(new ImmutableBytesPtr(kv.getFamily()));
        if (map == null)
            return kv;
       
        Pair<byte[], byte[]> col = map.get(new ImmutableBytesPtr(kv.getQualifier()));
        if (col == null)
            return kv;
       
        return KeyValueUtil.newKeyValue(kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength(),
                col.getFirst(), col.getSecond(), kv.getTimestamp(), kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
View Full Code Here

            int count = WritableUtils.readVInt(input);
            ImmutableBytesPtr[] joinIds = new ImmutableBytesPtr[count];
            List<Expression>[] joinExpressions = new List[count];
            JoinType[] joinTypes = new JoinType[count];
            for (int i = 0; i < count; i++) {
                joinIds[i] = new ImmutableBytesPtr();
                joinIds[i].readFields(input);
                int nExprs = WritableUtils.readVInt(input);
                joinExpressions[i] = new ArrayList<Expression>(nExprs);
                for (int j = 0; j < nExprs; j++) {
                    int expressionOrdinal = WritableUtils.readVInt(input);
View Full Code Here

                for (int i = 0; i < nRows; i++) {
                    int resultSize = (int)Bytes.readVLong(hashCacheByteArray, offset);
                    offset += WritableUtils.decodeVIntSize(hashCacheByteArray[offset]);
                    ImmutableBytesWritable value = new ImmutableBytesWritable(hashCacheByteArray,offset,resultSize);
                    Tuple result = new ResultTuple(new Result(value));
                    ImmutableBytesPtr key = new ImmutableBytesPtr(TupleUtil.getConcatenatedValue(result, onExpressions));
                    List<Tuple> tuples = hashCacheMap.get(key);
                    if (tuples == null) {
                        tuples = new ArrayList<Tuple>(1);
                        hashCacheMap.put(key, tuples);
                    }
View Full Code Here

                            }
                            byte[] qualifier = ref.getQualifier();
                            for (KeyValue kv : kvs) {
                                if (Bytes.compareTo(kv.getBuffer(), kv.getFamilyOffset(), kv.getFamilyLength(), family, 0, family.length) == 0 &&
                                    Bytes.compareTo(kv.getBuffer(), kv.getQualifierOffset(), kv.getQualifierLength(), qualifier, 0, qualifier.length) == 0) {
                                    return new ImmutableBytesPtr(kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
                                }
                            }
                            return null;
                        }
                       
View Full Code Here

                boolean isNullable = true;
                boolean isDataColumnInverted = false;
                ColumnModifier dataColumnModifier = null;
                if (dataPkPosition[i] == -1) {
                    dataColumnType = indexedColumnTypes.get(j);
                    ImmutableBytesPtr value = valueGetter.getLatestValue(iterator.next());
                    if (value == null) {
                        ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
                    } else {
                        ptr.set(value.copyBytesIfNecessary());
                    }
                    j++;
               } else {
                   Field field = dataRowKeySchema.getField(dataPkPosition[i]);
                    dataColumnType = field.getDataType();
View Full Code Here

TOP

Related Classes of org.apache.hbase.index.util.ImmutableBytesPtr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.