code: public void insertRecord(long recordPointer, int partitionId) {
      if (!hasSpaceForAnotherRecord()) {
        throw new IllegalStateException("There is no space for new record");
      }
      array.set(pos, PackedRecordPointer.packPointer(recordPointer, partitionId));
      pos++;
    }
docs: Inserts a record to be sorted.
  
  @param recordPointer a pointer to the record, encoded by the task memory manager. Due to
  certain pointer compression techniques used by the sorter, the sort can
  only operate on pointers that point to locations in the first
  {@link PackedRecordPointer#MAXIMUM_PAGE_SIZE_BYTES} bytes of a data page.
  @param partitionId the partition id, which must be less than or equal to
  {@link PackedRecordPointer#MAXIMUM_PARTITION_ID}.