public static int compare(Object[] o1, ObjectInspector[] oi1, Object[] o2,
      ObjectInspector[] oi2, boolean[] columnSortOrderIsDesc, NullValueOption[] nullSortOrder) {
    assert (o1.length == oi1.length);
    assert (o2.length == oi2.length);
    assert (o1.length == o2.length);
    assert (o1.length == columnSortOrderIsDesc.length);
    assert (o1.length == nullSortOrder.length);

    for (int i = 0; i < o1.length; i++) {
      int r = compareNull(o1[i], o2[i]);
      if (r != 0) {
        return nullSortOrder[i] == NullValueOption.MINVALUE ? -r : r;
      }

      if (columnSortOrderIsDesc[i]) {
        r = compare(o2[i], oi2[i], o1[i], oi1[i]);
      } else {
        r = compare(o1[i], oi1[i], o2[i], oi2[i]);
      }
      if (r != 0) {
        return r;
      }
    }
    return 0;
  }
Compare two arrays of objects with their respective arrays of
ObjectInspectors.
serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java