@Override
  public int compare(KeyWrapper key1, KeyWrapper key2) {
    return ObjectInspectorUtils.compare(
            key1.getKeyArray(),
            key1.isCopy() ? copyObjectInspectors : newObjectInspectors,
            key2.getKeyArray(),
            key2.isCopy() ? copyObjectInspectors : newObjectInspectors,
            columnSortOrderIsDesc,
            nullSortOrder);
  }
Comparator for {@link KeyWrapper}.
This comparator uses the {@link ObjectInspector}s provided in the newObjectInspectors array to extract key values
from wrapped Object arrays by default.
{@link KeyWrapper} instances are cloned when {@link KeyWrapper#copyKey()} is called. In this case the wrapped
key values are deep copied and converted to standard objects using {@link ObjectInspectorUtils#copyToStandardObject}.
The comparator uses copyObjectInspectors when extracting key values from clones.
ql/src/java/org/apache/hadoop/hive/ql/exec/KeyWrapperComparator.java