Skip to content

GH-40128: [C++][Python] Preserve dictionaries in empty casts - #50837

Open
LarryHu0217 wants to merge 1 commit into
apache:mainfrom
LarryHu0217:codex/preserve-empty-dictionary-cast-40128
Open

GH-40128: [C++][Python] Preserve dictionaries in empty casts#50837
LarryHu0217 wants to merge 1 commit into
apache:mainfrom
LarryHu0217:codex/preserve-empty-dictionary-cast-40128

Conversation

@LarryHu0217

@LarryHu0217 LarryHu0217 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Run dictionary-to-dictionary casts through the cast kernel for zero-length inputs when the dictionary type changes.
  • Add a regression test that verifies both the widened index type and preserved dictionary values.

The generic zero-length scalar fast path creates an empty output dictionary and discards categories that are still attached to the input array. Other zero-length scalar operations continue to use the existing fast path.

Testing

  • cpp/build-40128-auto/debug/arrow-compute-scalar-cast-test (109 tests passed)
  • clang-format --dry-run --Werror on both changed files
  • git diff --check

AI assistance

I used Codex to help inspect the executor path, prepare the focused change, and draft the regression test. I reviewed the final diff, reproduced the failure before the fix, and ran the tests above locally.

Closes #40128

@uros-b

uros-b commented Aug 10, 2026

Copy link
Copy Markdown
Member

Fix looks narrowly scoped and properly tested, thank you @LarryHu0217!

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Aug 10, 2026
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.

[Python] Casting an empty dictionary array loses category information

2 participants