private byte[] getIndexRowKey(byte[] rowLocation, boolean nonUnique) {
   byte[] data = indexKeyAccumulator.finish();
   if (nonUnique) {
     // append the row location to the end of the bytes
     byte[] newData = Arrays.copyOf(data, data.length + rowLocation.length + 1);
     System.arraycopy(rowLocation, 0, newData, data.length + 1, rowLocation.length);
     data = newData;
   }
   assert data != null && data.length > 0 : "getIndexRowKey returned invalid data";
   return data;
 }
 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);
 }