presto-hive/src/main/java/io/prestosql/plugin/hive/util/MergingPageIterator.java/MergingPageIterator/compareTo
class MergingPageIterator:        @Override
        public int compareTo(PagePosition other)
        {
            for (int i = 0; i < sortFields.size(); i++) {
                int channel = sortFields.get(i);
                SortOrder order = sortOrders.get(i);
                Type type = types.get(channel);

                Block block = page.getBlock(channel);
                Block otherBlock = other.page.getBlock(channel);

                int result = order.compareBlockValue(type, block, position, otherBlock, other.position);
                if (result != 0) {
                    return result;
                }
            }
            return 0;
        }