@Override public void getKey(ImmutableBytesWritable ptr) { delegate.getKey(ptr); }
@Override protected ImmutableBytesWritable getGroupingKey(Tuple tuple, ImmutableBytesWritable ptr) throws SQLException { tuple.getKey(ptr); return ptr; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { tuple.getKey(ptr); return true; }
public ProjectedValueTuple(Tuple keyBase, long timestamp, byte[] projectedValue, int valueOffset, int valueLength, int bitSetLen) { keyBase.getKey(this.keyPtr); this.timestamp = timestamp; this.projectedValue.set(projectedValue, valueOffset, valueLength); this.bitSetLen = bitSetLen; }
@Override public byte[] getRowKey() { rs.getCurrentRow().getKey(rowKeyPtr); return ByteUtil.copyKeyBytesIfNecessary(rowKeyPtr); } };
@Override public byte[] getRowKey() { rs.getCurrentRow().getKey(rowKeyPtr); return ByteUtil.copyKeyBytesIfNecessary(rowKeyPtr); } };
public void updateLastScanRow(Tuple rowValues,Tuple nextRowValues) { this.moreValues = !isReversed ? nextRowValues != null : rowValues != null; if(!moreValues()){ return; } if (row == null) { row = new ImmutableBytesWritable(); } if (previousRow == null) { previousRow = new ImmutableBytesWritable(); } if (nextRowValues != null) { nextRowValues.getKey(row); } if (rowValues != null) { rowValues.getKey(previousRow); } offset++; }
public UnorderedResultAssertingIterator(Collection<Tuple> expectedResults) { this.expectedResults = new HashMap<ImmutableBytesWritable,Tuple>(expectedResults.size()); for (Tuple result : expectedResults) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); result.getKey(ptr); this.expectedResults.put(ptr,result); } }
@Override public Tuple next() throws SQLException { if (chunkComplete || lastKey == null) { return null; } Tuple next = delegate.next(); if (next != null) { // We actually keep going past the chunk size until the row key changes. This is // necessary for (at least) hash joins, as they can return multiple rows with the // same row key. Stopping a chunk at a row key boundary is necessary in order to // be able to start the next chunk on the next row key if (rowCount == chunkSize) { next.getKey(lastKey); } else if (rowCount > chunkSize && rowKeyChanged(next)) { chunkComplete = true; return null; } rowCount++; } else { lastKey = null; } return next; }
@Override public void assertNext(Tuple result) throws Exception { result.getKey(tempPtr); Tuple expected = expectedResults.remove(tempPtr); TestUtil.compareTuples(expected, result); } }
public static int compare(Tuple t1, Tuple t2, ImmutableBytesWritable ptr, int keyOffset) { t1.getKey(ptr); byte[] buf = ptr.get(); int offset = ptr.getOffset() + keyOffset; int length = ptr.getLength() - keyOffset; t2.getKey(ptr); return Bytes.compareTo(buf, offset, length, ptr.get(), ptr.getOffset() + keyOffset, ptr.getLength() - keyOffset); }
@Override public Tuple next() throws SQLException { while (true) { if (!initSnapshotScanner()) return null; try { lastTuple = scanIterator.next(); if (lastTuple != null) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); lastTuple.getKey(ptr); return lastTuple; } } finally { if (lastTuple == null) { scanIterator.close(); scanIterator = UNINITIALIZED_SCANNER; } } } }
private boolean rowKeyChanged(Tuple newTuple) { byte[] currentKey = lastKey.get(); int offset = lastKey.getOffset(); int length = lastKey.getLength(); newTuple.getKey(lastKey); return Bytes.compareTo(currentKey, offset, length, lastKey.get(), lastKey.getOffset(), lastKey.getLength()) != 0; }
public static Integer getRemainingOffset(Tuple offsetTuple) { if (offsetTuple != null) { ImmutableBytesPtr rowKeyPtr = new ImmutableBytesPtr(); offsetTuple.getKey(rowKeyPtr); if (QueryConstants.OFFSET_ROW_KEY_PTR.compareTo(rowKeyPtr) == 0) { Cell cell = offsetTuple.getValue(QueryConstants.OFFSET_FAMILY, QueryConstants.OFFSET_COLUMN); return PInteger.INSTANCE.toObject(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength(), PInteger.INSTANCE, SortOrder.ASC, null, null); } } return null; }
rs.getCurrentRow().getKey(dataRowKeyPtr);
if (lastTuple != null) { ImmutableBytesWritable ptr = new ImmutableBytesWritable(); lastTuple.getKey(ptr); newScan.withStartRow(newScan.getAttribute(SCAN_ACTUAL_START_ROW)); if(lastTuple != null) { lastTuple.getKey(ptr); byte[] startRowSuffix = ByteUtil.copyKeyBytesIfNecessary(ptr); if(ScanUtil.isLocalIndex(newScan)) {
while (rs.next()) { ImmutableBytesPtr rowKeyPtr = new ImmutableBytesPtr(); // allocate new as this is a key in a Map rs.getCurrentRow().getKey(rowKeyPtr);
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { tuple.getKey(ptr); int offset = accessor.getOffset(ptr.get(), ptr.getOffset() + this.offset); // Null is represented in the last expression of a multi-part key // by the bytes not being present. int maxOffset = ptr.getOffset() + ptr.getLength(); if (offset < maxOffset) { byte[] buffer = ptr.get(); int byteSize = -1; // FIXME: fixedByteSize <= maxByteSize ? fixedByteSize : 0 required because HBase passes bogus keys to filter to position scan (HBASE-6562) if (fromType.isFixedWidth()) { Integer maxLength = getMaxLength(); byteSize = fromType.getByteSize() == null ? maxLength : fromType.getByteSize(); byteSize = byteSize <= maxOffset ? byteSize : 0; } int length = byteSize >= 0 ? byteSize : accessor.getLength(buffer, offset, maxOffset); // In the middle of the key, an empty variable length byte array represents null if (length > 0) { ptr.set(buffer,offset,length); type.coerceBytes(ptr, fromType, getSortOrder(), getSortOrder()); } else { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } } else { ptr.set(ByteUtil.EMPTY_BYTE_ARRAY); } // Always return true because we're always able to evaluate a row key column return true; }