Skip to content

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Jan 23, 2026

Rationale for this change

Null-type dictionaries (e.g., dictionary(int8(), null())) are valid Arrow constructs supported from day one, but the sorting code had an uncertain XXX Should this support Type::NA? comment. We should explicitly support and test this because other functions already support this:

import pyarrow as pa
import pyarrow.compute as pc

pc.array_sort_indices(pa.array([None, None, None, None], type=pa.int32()))
# [0, 1, 2, 3]
pc.array_sort_indices(pa.DictionaryArray.from_arrays(
    indices=pa.array([None, None, None, None], type=pa.int8()),
    dictionary=pa.array([], type=pa.null())
))
# [0, 1, 2, 3]

I believe it does not make sense to specifically disallow this in dictionaries at this point.

What changes are included in this PR?

Added a unittest for null sorting behaviour.

Are these changes tested?

Yes, the unittest was added.

Are there any user-facing changes?

No.

@github-actions
Copy link

⚠️ GitHub issue #48954 has been automatically assigned in GitHub to PR creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant