@Override
        public boolean hasNext() {
            return position / 2 < numRecords;
        }
Inserts a record to be sorted. Assumes that the record pointer points to a record length
stored as a 4-byte integer, followed by the record's bytes.

@param recordPointer pointer to a record in a data page, encoded by {@link TaskMemoryManager}.
@param keyPrefix     a user-defined key prefix
indexr-query-opt/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java