Skip to content

GH-51210: [C++] Initialize output_ on empty select_k inputs - #51212

Open
taepper wants to merge 1 commit into
apache:mainfrom
taepper:select-k-unset-datum
Open

GH-51210: [C++] Initialize output_ on empty select_k inputs#51212
taepper wants to merge 1 commit into
apache:mainfrom
taepper:select-k-unset-datum

Conversation

@taepper

@taepper taepper commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

This fixes possible crashes of SelectKUnstable if inputs were empty

What changes are included in this PR?

This includes the bug fix and test cases which cover the broken prior behavior.

Are these changes tested?

Yes.

Are there any user-facing changes?

This PR contains a "Critical Fix".:
(c) a bug that causes a crash

If SelectKUnstable is called on an empty table or chunked-array the process terminates with the exception std::bad_variant_access.

Through python, the wrapping of the (invalid) Datum in a python object already fails with the following error message:

ValueError: Unable to wrap Datum in a Python object

@taepper
taepper force-pushed the select-k-unset-datum branch from 1be8398 to 0cbf916 Compare September 7, 2026 13:17

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @taepper !

@pitrou pitrou added Critical Fix Bugfixes for security vulnerabilities, crashes, or invalid data. backport-candidate labels Sep 7, 2026
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting committer review Awaiting committer review backport-candidate Component: C++ Critical Fix Bugfixes for security vulnerabilities, crashes, or invalid data.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants