Skip to content

[FEA] Support input of dictionary-encoded types in Transforms - #21552

Merged
rapids-bot[bot] merged 27 commits into
NVIDIA:mainfrom
lamarrr:transform-dict-support
Jul 3, 2026
Merged

[FEA] Support input of dictionary-encoded types in Transforms#21552
rapids-bot[bot] merged 27 commits into
NVIDIA:mainfrom
lamarrr:transform-dict-support

Conversation

@lamarrr

@lamarrr lamarrr commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Description

This pull-request adds support for dictionary-encoded types in the transform and filter APIs.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@lamarrr
lamarrr requested a review from a team as a code owner February 25, 2026 10:37
@lamarrr
lamarrr requested review from bdice and mhaseeb123 February 25, 2026 10:37
@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Feb 25, 2026
@lamarrr
lamarrr requested a review from davidwendt February 25, 2026 10:37
@lamarrr lamarrr added feature request New feature or request non-breaking Non-breaking change labels Feb 25, 2026
Comment thread cpp/include/cudf/column/column_device_view_base.cuh Outdated
Comment thread cpp/include/cudf/column/column_device_view_base.cuh Outdated
Comment thread cpp/src/jit/helpers.cpp Outdated
Comment thread cpp/src/transform/transform.cu Outdated
@davidwendt

Copy link
Copy Markdown
Contributor

This is awesome.
It appears that the transform can now accept dictionary types but cannot produce them which is fine.
I believe producing a dictionary would simply require encoding the resulting column as extra post-process step.
But we would need a way to convey the key-type so the intermediate can be formed in the UDF.

@lamarrr lamarrr changed the title [FEA] Support dictionary-encoded types in Transforms [FEA] Support input of dictionary-encoded types in Transforms Feb 25, 2026
lamarrr and others added 3 commits February 25, 2026 14:09
Co-authored-by: David Wendt <45795991+davidwendt@users.noreply.github.com>
Comment thread cpp/include/cudf/dictionary/dictionary_column_view.hpp Outdated
Comment thread cpp/include/cudf/column/column_device_view_base.cuh Outdated
Comment thread cpp/include/cudf/column/column_device_view_base.cuh Outdated
Comment thread cpp/include/cudf/column/column_device_view_base.cuh Outdated
Comment thread cpp/include/cudf/dictionary/dictionary_column_view.hpp
Comment thread cpp/src/jit/helpers.cpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
lamarrr and others added 2 commits March 4, 2026 22:02
Co-authored-by: Muhammad Haseeb <14217455+mhaseeb123@users.noreply.github.com>
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
Comment thread cpp/include/cudf/column/column_child_offsets.h Outdated
Comment thread cpp/src/transform/transform.cu Outdated
Comment thread cpp/src/jit/helpers.cpp Outdated
Comment thread cpp/include/cudf/column/column_child_offsets.hpp
Comment thread cpp/include/cudf/column/column_child_offsets.hpp Outdated
Comment thread cpp/include/cudf/transform.hpp Outdated
Comment thread cpp/src/transform/transform.cu Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp Outdated
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds shared child-column index constants, dictionary-encoded device column access, and dictionary-aware JIT transform reflection and validation. Public docs and integration tests now cover dictionary inputs for CUDA and PTX transform paths.

Changes

Dictionary support in JIT transform

Layer / File(s) Summary
Shared child column index constants
cpp/include/cudf/column/column_child_offsets.hpp, cpp/include/cudf/dictionary/dictionary_column_view.hpp
New header defines shared child-column index constants; dictionary_column_view replaces hard-coded child indices with the named constants.
Device-side dictionary element decoding
cpp/include/cudf/column/column_device_view_base.cuh
Adds dictionary_element and is_dictionary_encoded, centralizes offsets_column_index, and adds dictionary key decoding in column_device_view_core::element.
column_accessor return type deduction
cpp/src/jit/column_accessor.cuh
Changes element() and nullable_element() to return auto while preserving forwarding behavior.
JIT type reflection and validation
cpp/src/jit/helpers.cpp, cpp/src/jit/helpers.hpp, cpp/src/transform/transform.cu
Updates includes, removes input_type_names, adds dictionary-aware reflection helpers, changes PTX type-list generation, and broadens input validation for PTX and non-PTX paths.
Public API documentation update
cpp/include/cudf/transform.hpp
Revises transform_extended and multi_transform docs to list dictionary types in the supported CUDA/PTX categories.
Integration tests for dictionary transforms
cpp/tests/transform/integration/unary_transform_test.cpp
Adds dictionary string and float transform tests for nullable and non-nullable columns across CUDA and PTX UDFs.

Estimated code review effort: 4 (Complex) | ~50 minutes

Possibly related PRs

  • rapidsai/cudf#22654 — Modifies cpp/src/transform/transform.cu’s JIT reflection and validation flow in a nearby area.

Suggested labels: improvement

Suggested reviewers: bdice, qbacpey

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding dictionary-encoded input support for transforms.
Description check ✅ Passed The description is directly related to the changeset and describes the new dictionary-encoded transform support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cpp/include/cudf/column/column_device_view_base.cuh`:
- Around line 518-521: The dictionary decode path in
column_device_view_core::element is using the raw element_index from the indices
child and ignores the parent slice offset set by slice(), so sliced dictionary
views can return the wrong key. Update the dictionary branch to read the indices
child at element_index + offset() (mirroring the string-path handling) while
keeping the existing child() and keys lookup logic intact.

In `@cpp/include/cudf/transform.hpp`:
- Around line 99-101: The PTX capability docs in transform.hpp overstate support
by saying PTX accepts all fixed-width inputs and outputs, but perform_checks()
in transform.cu still only allows integral/floating-point value types and
dictionary inputs whose values are integral/floating-point. Update the
documentation around the transform API (including the referenced input/output
type comments) to match the actual runtime constraints, explicitly limiting PTX
to the value types that perform_checks() permits and avoiding mention of
unsupported fixed-width types like timestamps, durations, and fixed-point.

In `@cpp/tests/transform/integration/unary_transform_test.cpp`:
- Around line 417-459: The TransformDictionaryString coverage only tests full
dictionary columns, so add a sliced dictionary input case to exercise the
offset-sensitive path through dictionary children/device views. Extend
UnaryOperationIntegrationTest::TransformDictionaryString (and the related
dictionary transform tests in the same area) by creating a sliced strings
column, encoding it, and verifying transform_extended on the slice matches the
expected sliced input values for both nullable and non-nullable cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 23ca6781-4c6b-4d56-a1a7-6d12d7346480

📥 Commits

Reviewing files that changed from the base of the PR and between ef60a7b and 71c227c.

📒 Files selected for processing (8)
  • cpp/include/cudf/column/column_child_offsets.hpp
  • cpp/include/cudf/column/column_device_view_base.cuh
  • cpp/include/cudf/dictionary/dictionary_column_view.hpp
  • cpp/include/cudf/transform.hpp
  • cpp/src/jit/column_accessor.cuh
  • cpp/src/jit/helpers.cpp
  • cpp/src/transform/transform.cu
  • cpp/tests/transform/integration/unary_transform_test.cpp

Comment thread cpp/include/cudf/column/column_device_view_base.cuh
Comment thread cpp/include/cudf/transform.hpp Outdated
Comment thread cpp/tests/transform/integration/unary_transform_test.cpp
@lamarrr

lamarrr commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

New dictionary tests miss the empty-column edge case. Like this:

@ttnghia, that will be testing a behaviour independent of dictionary transforms. Is there a particular reason why we have to test specifically for zero-length dictionaries?

And also there is no test for dictionary input with PTX source type. Should be like this:

PTX transforms with dictionary inputs are now supported

@ttnghia

ttnghia commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@ttnghia, that will be testing a behaviour independent of dictionary transforms. Is there a particular reason why we have to test specifically for zero-length dictionaries?

Just to make sure the code cover edge cases.

@lamarrr

lamarrr commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 8597870 into NVIDIA:main Jul 3, 2026
136 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants