Skip to content

[C++][Compute] Implement TopK/BottomK #17579

Closed

Description

@asfimport

Heap-based topk can compute these indices in O(n log k) time

Reporter: Wes McKinney / @wesm
Assignee: Alexander Ocsa / @aocsa

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-1565. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Feb 18, 2020

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    Another possibility is to use quickselect.

  2. asfimport commented on May 25, 2020

    @asfimport
    Author

    Wes McKinney / @wesm:
    I reframed this issue as a query processing task. We need to be able to compute TopK/BottomK with chunked data

  3. asfimport commented on Aug 4, 2021

    @asfimport
    Author
  4. asfimport commented on Aug 9, 2021

    @asfimport
    Author

    David Li / @lidavidm:
    Daniel Lemire compared various approaches (modifications of the heap approach or modifications of quickselect) and found that the heap wins in his tests: https://lemire.me/blog/2017/06/21/top-speed-for-top-k-queries/

    If we want this to perfectly emulate Pandas's nlargest/nsmallest then there are some additional complications (inputs must have a defined order to resolve ties, and/or we must be able to track and output duplicate values).

  5. asfimport commented on Sep 10, 2021

    @asfimport
    Author

    David Li / @lidavidm:
    Issue resolved by pull request 11019
    #11019

  6. added this to the 6.0.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions