Skip to content

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

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

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