engine_build_runs Interface

interface
public module subroutine engine_build_runs(keys, nrows, proc, perm, tie, threads, group_ekeys)

Arguments

Type IntentOptional Attributes Name
type(sort_key_buf), intent(in), target :: keys(:)

the keys, primary first.

integer(kind=int64), intent(in) :: nrows

rows each key describes.

character(len=*), intent(in) :: proc

calling procedure, for messages.

integer(kind=int64), intent(out), allocatable :: perm(:)

the 1-based permutation.

integer(kind=c_int8_t), intent(out), allocatable :: tie(:)

1 where a row ties the previous.

integer, intent(in), optional :: threads

thread request; absent = auto.

integer, intent(in), optional :: group_ekeys

How many LEADING keys decide whether two rows tie; absent means all of them. Counted in ENGINE keys, already resolved from the caller's key count -- the two differ because one %add of a parquet_timestamp contributes two engine keys. The sort itself always uses every key; only the tie test is narrowed.

Description

Sorts, and reports where the runs of EQUAL rows are: tie(k) is 1 when output position k holds a row comparing equal to the one before it. One call, because pf_unique/pf_rank need both and would otherwise build the permutation twice.