コード例 #1
0
 /**
  * because the field is NULL and it's source is the incoming mutation, we still need to accumulate
  * it. We must be careful, however, to accumulate the proper null value.
  *
  * <p>In theory, we could use a sparse encoding here--just accumulate a length 0 entry, which will
  * allow us to use a very short row key to determine nullity. However, that doesn't work
  * correctly, because doubles and floats at the end of the index might decode the row key as a
  * double, resulting in goofball answers.
  *
  * <p>Instead, we must use the dense encoding approach here. That means that we must select the
  * proper dense type based on columnTypes[i]. For most data types, this is still a length-0 array,
  * but for floats and doubles it will put the proper type into place.
  */
 private void accumulateNull(EntryAccumulator keyAccumulator, int pos, int type) {
   if (typeProvider.isScalar(type))
     keyAccumulator.addScalar(pos, SIConstants.EMPTY_BYTE_ARRAY, 0, 0);
   else if (typeProvider.isDouble(type))
     keyAccumulator.addDouble(
         pos, Encoding.encodedNullDouble(), 0, Encoding.encodedNullDoubleLength());
   else if (typeProvider.isFloat(type))
     keyAccumulator.addDouble(
         pos, Encoding.encodedNullFloat(), 0, Encoding.encodedNullFloatLength());
   else keyAccumulator.add(pos, SIConstants.EMPTY_BYTE_ARRAY, 0, 0);
 }
コード例 #2
0
 private boolean skip(MultiFieldDecoder keyDecoder, int sourceKeyColumnType) {
   boolean isNull;
   if (typeProvider.isScalar(sourceKeyColumnType)) {
     isNull = keyDecoder.nextIsNull();
     keyDecoder.skipLong();
   } else if (typeProvider.isDouble(sourceKeyColumnType)) {
     isNull = keyDecoder.nextIsNullDouble();
     keyDecoder.skipDouble();
   } else if (typeProvider.isFloat(sourceKeyColumnType)) {
     isNull = keyDecoder.nextIsNullFloat();
     keyDecoder.skipFloat();
   } else {
     isNull = keyDecoder.nextIsNull();
     keyDecoder.skip();
   }
   return isNull;
 }
コード例 #3
0
 private void accumulate(
     EntryAccumulator keyAccumulator,
     int pos,
     int type,
     boolean reverseOrder,
     byte[] array,
     int offset,
     int length) {
   byte[] data = array;
   int off = offset;
   if (reverseOrder) {
     // TODO -sf- could we cache these byte[] somehow?
     data = new byte[length];
     System.arraycopy(array, offset, data, 0, length);
     for (int i = 0; i < data.length; i++) {
       data[i] ^= 0xff;
     }
     off = 0;
   }
   if (typeProvider.isScalar(type)) keyAccumulator.addScalar(pos, data, off, length);
   else if (typeProvider.isDouble(type)) keyAccumulator.addDouble(pos, data, off, length);
   else if (typeProvider.isFloat(type)) keyAccumulator.addFloat(pos, data, off, length);
   else keyAccumulator.add(pos, data, off, length);
 }