@SuppressWarnings("deprecation") @Override protected void writeToBuffer(MappedByteBuffer buffer, Tuple e) { KeyValue kv = KeyValueUtil.ensureKeyValue(e.getValue(0)); buffer.putInt(kv.getLength() + Bytes.SIZEOF_INT); buffer.putInt(kv.getLength()); buffer.put(kv.getBuffer(), kv.getOffset(), kv.getLength()); }
public ProjectedValueTuple projectResults(Tuple tuple) { byte[] bytesValue = schema.toBytes(tuple, expressions, valueSet, ptr); Cell base = tuple.getValue(0); return new ProjectedValueTuple( base.getRowArray(), base.getRowOffset(), base.getRowLength(), base.getTimestamp(), bytesValue, valueSet.getEstimatedLength()); }
private Tuple join(Tuple lhs, Tuple rhs) throws SQLException { try { ProjectedValueTuple t = null; if (lhs == null) { t = new ProjectedValueTuple( rhs, rhs.getValue(0).getTimestamp(), this.emptyProjectedValue, 0, this.emptyProjectedValue.length, this.emptyProjectedValue.length); } else if (lhs instanceof ProjectedValueTuple) { t = (ProjectedValueTuple) lhs; } else { ImmutableBytesWritable ptr = context.getTempPtr(); TupleProjector.decodeProjectedValue(lhs, ptr); lhsBitSet.clear(); lhsBitSet.or(ptr); int bitSetLen = lhsBitSet.getEstimatedLength(); t = new ProjectedValueTuple( lhs, lhs.getValue(0).getTimestamp(), ptr.get(), ptr.getOffset(), ptr.getLength(), bitSetLen); } return rhsBitSet == ValueBitSet.EMPTY_VALUE_BITSET ? t : TupleProjector.mergeProjectedValue( t, joinedSchema, destBitSet, rhs, rhsSchema, rhsBitSet, rhsFieldPosition); } catch (IOException e) { throw new SQLException(e); } }
public static void decodeProjectedValue(Tuple tuple, ImmutableBytesWritable ptr) throws IOException { boolean b = tuple.getValue(VALUE_COLUMN_FAMILY, VALUE_COLUMN_QUALIFIER, ptr); if (!b) throw new IOException("Trying to decode a non-projected value."); }
@Override protected int sizeOf(Tuple e) { KeyValue kv = KeyValueUtil.ensureKeyValue(e.getValue(0)); return Bytes.SIZEOF_INT * 2 + kv.getLength(); }