public static Output serializeRow(Output byteStream, Object[] fieldData,
      List<ObjectInspector> fieldOis, boolean[] sortableSortOrders,
      byte[] nullMarkers, byte[] notNullMarkers) throws HiveException {
    if (byteStream == null) {
      byteStream = new Output();
    } else {
      byteStream.reset();
    }
    try {
      if (fieldData.length == 0) {
        byteStream.reset();
      } else if (sortableSortOrders == null) {
        LazyBinarySerDe.serializeStruct(byteStream, fieldData, fieldOis);
      } else {
        BinarySortableSerDe.serializeStruct(byteStream, fieldData, fieldOis, sortableSortOrders,
                nullMarkers, notNullMarkers);
      }
    } catch (SerDeException e) {
      throw new HiveException("Serialization error", e);
    }
    return byteStream;
  }
Serializes row to output.
@param byteStream Output to reuse. Can be null, in that case a new one would be created.
ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinKey.java