Пример #1
0
 public static ProjectedValueTuple mergeProjectedValue(
     ProjectedValueTuple dest,
     KeyValueSchema destSchema,
     ValueBitSet destBitSet,
     Tuple src,
     KeyValueSchema srcSchema,
     ValueBitSet srcBitSet,
     int offset)
     throws IOException {
   ImmutableBytesWritable destValue = new ImmutableBytesWritable(dest.getProjectedValue());
   destBitSet.clear();
   destBitSet.or(destValue);
   int origDestBitSetLen = dest.getBitSetLength();
   ImmutableBytesWritable srcValue = new ImmutableBytesWritable();
   decodeProjectedValue(src, srcValue);
   srcBitSet.clear();
   srcBitSet.or(srcValue);
   int origSrcBitSetLen = srcBitSet.getEstimatedLength();
   for (int i = 0; i < srcBitSet.getMaxSetBit(); i++) {
     if (srcBitSet.get(i)) {
       destBitSet.set(offset + i);
     }
   }
   int destBitSetLen = destBitSet.getEstimatedLength();
   byte[] merged =
       new byte
           [destValue.getLength()
               - origDestBitSetLen
               + srcValue.getLength()
               - origSrcBitSetLen
               + destBitSetLen];
   int o =
       Bytes.putBytes(
           merged,
           0,
           destValue.get(),
           destValue.getOffset(),
           destValue.getLength() - origDestBitSetLen);
   o =
       Bytes.putBytes(
           merged,
           o,
           srcValue.get(),
           srcValue.getOffset(),
           srcValue.getLength() - origSrcBitSetLen);
   destBitSet.toBytes(merged, o);
   ImmutableBytesWritable keyPtr = dest.getKeyPtr();
   return new ProjectedValueTuple(
       keyPtr.get(),
       keyPtr.getOffset(),
       keyPtr.getLength(),
       dest.getTimestamp(),
       merged,
       destBitSetLen);
 }
Пример #2
0
 public BasicJoinIterator(ResultIterator lhsIterator, ResultIterator rhsIterator) {
   this.lhsIterator = lhsIterator;
   this.rhsIterator = rhsIterator;
   this.initialized = false;
   this.lhsTuple = null;
   this.rhsTuple = null;
   this.lhsKey = new JoinKey(lhsKeyExpressions);
   this.rhsKey = new JoinKey(rhsKeyExpressions);
   this.nextLhsTuple = null;
   this.nextRhsTuple = null;
   this.nextLhsKey = new JoinKey(lhsKeyExpressions);
   this.nextRhsKey = new JoinKey(rhsKeyExpressions);
   this.destBitSet = ValueBitSet.newInstance(joinedSchema);
   this.lhsBitSet = ValueBitSet.newInstance(lhsSchema);
   this.rhsBitSet = ValueBitSet.newInstance(rhsSchema);
   lhsBitSet.clear();
   int len = lhsBitSet.getEstimatedLength();
   this.emptyProjectedValue = new byte[len];
   lhsBitSet.toBytes(emptyProjectedValue, 0);
   this.queue = new MappedByteBufferTupleQueue(thresholdBytes);
   this.queueIterator = null;
 }