Package org.apache.phoenix.hbase.index.util

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


        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


                // when referencedCfCount is >1 and no Hints, we are not using the optimization
                useOptimization = referencedCfCount == 1;
            }
            if (useOptimization) {
                for (Entry<byte[], NavigableSet<byte[]>> entry : familyMap.entrySet()) {
                    ImmutableBytesPtr cf = new ImmutableBytesPtr(entry.getKey());
                    NavigableSet<byte[]> qs = entry.getValue();
                    NavigableSet<ImmutableBytesPtr> cols = null;
                    if (qs != null) {
                        cols = new TreeSet<ImmutableBytesPtr>();
                        for (byte[] q : qs) {
                            cols.add(new ImmutableBytesPtr(q));
                        }
                    }
                    columnsTracker.put(cf, cols);
                }
            }
View Full Code Here

    @Override
    public ImmutableBytesPtr getBytesPtr() {
        if (data.ptr == null) {
            synchronized (data.bytesName) {
                if (data.ptr == null) {
                    this.data.ptr = new ImmutableBytesPtr(data.bytesName);
                }
            }
        }
        return this.data.ptr;
    }
View Full Code Here

        public PRowImpl(KeyValueBuilder kvBuilder, ImmutableBytesWritable key, long ts, Integer bucketNum) {
            this.kvBuilder = kvBuilder;
            this.ts = ts;
            if (bucketNum != null) {
                this.key = SaltingUtil.getSaltedKey(key, bucketNum);
                this.keyPtr = new ImmutableBytesPtr(this.key);
            } else {
                this.keyPtr =  new ImmutableBytesPtr(key);
                this.key = ByteUtil.copyKeyBytesIfNecessary(key);
            }

            newMutations();
        }
View Full Code Here

                    }
              }
                removeIfPresent(unsetValues, family, qualifier);
                addQuietly(setValues, kvBuilder, kvBuilder.buildPut(keyPtr, column.getFamilyName()
                        .getBytesPtr(),
                        column.getName().getBytesPtr(), ts, new ImmutableBytesPtr(byteValue)));
            }
        }
View Full Code Here

            this.cf = cf;
        } else {
            this.cf = new byte[cfLength];
            System.arraycopy(cf, cfOffset, this.cf, 0, cfLength);
        }
        return new ImmutableBytesPtr(cq, cqOffset, cqLength);
    }
View Full Code Here

    private Iterator<Pair<byte[],List<Mutation>>> addRowMutations(final TableRef tableRef, final Map<ImmutableBytesPtr, Map<PColumn, byte[]>> values, long timestamp, boolean includeMutableIndexes) {
        final List<Mutation> mutations = Lists.newArrayListWithExpectedSize(values.size());
        Iterator<Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>>> iterator = values.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<ImmutableBytesPtr,Map<PColumn,byte[]>> rowEntry = iterator.next();
            ImmutableBytesPtr key = rowEntry.getKey();
            PRow row = tableRef.getTable().newRow(connection.getKeyValueBuilder(), timestamp, key);
            if (rowEntry.getValue() == PRow.DELETE_MARKER) { // means delete
                row.delete();
            } else {
                for (Map.Entry<PColumn,byte[]> valueEntry : rowEntry.getValue().entrySet()) {
View Full Code Here

                boolean isNullable = true;
                boolean isDataColumnInverted = false;
                SortOrder dataSortOrder = SortOrder.getDefault();
                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

        // New row being inserted: add the empty key value
        if (valueGetter.getLatestValue(dataEmptyKeyValueRef) == null) {
            byte[] indexRowKey = this.buildRowKey(valueGetter, dataRowKeyPtr);
            put = new Put(indexRowKey);
            // add the keyvalue for the empty row
            put.add(kvBuilder.buildPut(new ImmutableBytesPtr(indexRowKey),
                this.getEmptyKeyValueFamily(), QueryConstants.EMPTY_COLUMN_BYTES_PTR, ts,
                ByteUtil.EMPTY_BYTE_ARRAY_PTR));
            put.setWriteToWAL(!indexWALDisabled);
        }
        int i = 0;
        for (ColumnReference ref : this.getCoverededColumns()) {
            ImmutableBytesPtr cq = this.indexQualifiers.get(i++);
            ImmutableBytesPtr value = valueGetter.getLatestValue(ref);
            byte[] indexRowKey = this.buildRowKey(valueGetter, dataRowKeyPtr);
            ImmutableBytesPtr rowKey = new ImmutableBytesPtr(indexRowKey);
            if (value != null) {
                if (put == null) {
                    put = new Put(indexRowKey);
                    put.setWriteToWAL(!indexWALDisabled);
                }
View Full Code Here

            newState.put(new ColumnReference(kv.getFamily(), kv.getQualifier()), kv);
        }
        for (ColumnReference ref : indexedColumns) {
            KeyValue newValue = newState.get(ref);
            if (newValue != null) { // Indexed column was potentially changed
                ImmutableBytesPtr oldValue = oldState.getLatestValue(ref);
                // If there was no old value or the old value is different than the new value, the index row needs to be deleted
                if (oldValue == null ||
                        Bytes.compareTo(oldValue.get(), oldValue.getOffset(), oldValue.getLength(),
                                                   newValue.getBuffer(), newValue.getValueOffset(), newValue.getValueLength()) != 0){
                    return true;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.phoenix.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.