Skip to content

[C++][Compute] Rank function considers NaNs and nulls equal #45193

Closed

Description

@pitrou

Describe the bug, including details regarding any error messages, version, and platform.

Expected (NaNs and nulls are distinct, ordered according to null_placement):

>>> a = pa.array([1, None, math.nan, 2, math.nan, None])
>>> pc.rank(a, tiebreaker='min', null_placement='at_end')
<pyarrow.lib.UInt64Array object at 0x7f168295ca00>
[
  1,
  5,
  3,
  2,
  3,
  5
]
>>> pc.rank(a, tiebreaker='min', null_placement='at_start')
<pyarrow.lib.UInt64Array object at 0x7f1682845600>
[
  5,
  1,
  3,
  6,
  3,
  1
]

Actual (NaNs and nulls are considered ties):

>>> pc.rank(a, tiebreaker='min', null_placement='at_end')
<pyarrow.lib.UInt64Array object at 0x7f1682951660>
[
  1,
  3,
  3,
  2,
  3,
  3
]
>>> pc.rank(a, tiebreaker='min', null_placement='at_start')
<pyarrow.lib.UInt64Array object at 0x7f1682845600>
[
  5,
  1,
  1,
  6,
  1,
  1
]

Component(s)

C++

Activity

  1. timgrein commented on Jan 11, 2025

    @timgrein
    Contributor

    Hey 👋

    Recently started to look more deeply into Arrow, I would love to get my hands dirty with some smaller issues. Do you think this is one is a good starting point? If yes, I would like to give it a shot :)

  2. pitrou commented on Jan 13, 2025

    @pitrou
    MemberAuthor

    Hi @timgrein , yes, I think it would be a good issue to start if you already have some familiarity with the basic Arrow C++ APIs. However, there is a refactor going on in #45217 (probably soon merged), so you should probably base your work on that.

  3. pitrou commented on Jan 13, 2025

    @pitrou
    MemberAuthor

    Update: the aforementioned PR was merged, so you can start from git main :)

  4. curioustien commented on Feb 17, 2025

    @curioustien
    Contributor

    I can take a stab at this during my free time too

  5. curioustien commented on Mar 9, 2025

    @curioustien
    Contributor

    take

  6. abhishek593 commented on Feb 17, 2026

    @abhishek593
    Contributor

    take

  7. added 2 commits that reference this issue on Feb 17, 2026
  8. added 2 commits that reference this issue on Mar 10, 2026
  9. added 3 commits that reference this issue on Apr 17, 2026
  10. added a commit that references this issue on Apr 21, 2026
  11. added this to the 25.0.0 milestone on Apr 21, 2026
  12. pitrou commented on Apr 21, 2026

    @pitrou
    MemberAuthor

    Issue resolved by pull request 49304
    #49304

  13. added a commit that references this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions