Skip to content

Setting key to an existing index can skip forder step #2889

@MichaelChirico

Description

@MichaelChirico

Consider

DT = data.table(
  ID1 = rep(10:1, 10:1),
  ID2 = rep(1:10, 1:10)
)
setindex(DT, ID1, verbose = TRUE)
# forder took 0 sec
setkey(DT, ID1, verbose = TRUE)
# forder took 0 sec
# reorder took 0 sec

I believe the second forder is superfluous -- only the physical reordering is necessary in the setkey.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions