Skip to content

Add decimal support to VARIANT casting - #23858

Draft
vuule wants to merge 6 commits into
NVIDIA:mainfrom
vuule:variant-decimal-cast
Draft

Add decimal support to VARIANT casting#23858
vuule wants to merge 6 commits into
NVIDIA:mainfrom
vuule:variant-decimal-cast

Conversation

@vuule

@vuule vuule commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

closes #23817

cast_variant and extract_variant_field now accept DECIMAL32/DECIMAL64/DECIMAL128 target types, decoding the DECIMAL4/8/16 VARIANT primitives.

The encoding stores a scale per value while a cuDF column carries a single scale, so each value is rescaled to desired_type.scale(). A value that does not fit the target after rescaling is nulled and reported as variant_operation_status::OVERFLOW. An out-of-range scale byte or a truncated payload reports MALFORMED_VARIANT, and a non-decimal encoding reports TYPE_MISMATCH.

Also added test and benchmark coverage.

Checklist

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

cast_variant and extract_variant_field now accept DECIMAL32/64/128 targets.
The VARIANT encoding scales every value individually while a cuDF column
carries a single scale, so each value is rescaled to the requested scale,
truncating toward zero, and a value that no longer fits the target
representation is nulled with the OVERFLOW status.
@copy-pr-bot

copy-pr-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Aug 27, 2026
vuule added 3 commits August 27, 2026 02:03
…hmark decimals

Adds a DECIMAL16 test at the int128 limits, which the previous cases left the
high half of the payload zeroed for, and a sliced 512-row case so the decimal
kernel's grid-stride loop and slice offset are covered.

Factors the incoming-status and null-bit preamble the cast paths share into
should_decode_row, so the protocol lives in one place instead of three, and
extends the variant nvbench with decimal32 and decimal128 cases.
@vuule vuule added feature request New feature or request non-breaking Non-breaking change labels Aug 27, 2026
vuule added 2 commits August 27, 2026 23:19
Adds a DECIMAL64 arm to the overflow test, the only place the int64_t
range check is reachable, and a decimal64 case to the cast benchmark's
type axis.
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.

[FEA] Add DECIMAL decoding for Parquet VARIANT values

1 participant