Skip to content

Add Java Variant logical type inspection support - #23734

Open
nartal1 wants to merge 3 commits into
NVIDIA:mainfrom
nartal1:logical-type-id
Open

Add Java Variant logical type inspection support#23734
nartal1 wants to merge 3 commits into
NVIDIA:mainfrom
nartal1:logical-type-id

Conversation

@nartal1

@nartal1 nartal1 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #23184.

Adds cuDF Java and JNI bindings for the experimental Variant logical type inspection API introduced by #23491.

This PR adds:

  • VariantUtils.getVariantTypeId(ColumnView), returning an owning UINT8 column of logical type IDs
  • the experimental VariantLogicalType Java enum with explicit values matching libcudf
  • a JNI wrapper for cudf::io::parquet::experimental::get_variant_type_id

The Java API follows the libcudf behavior for input nulls, encoded Variant nulls, empty values, unrecognized headers, and header-only classification.

This also adds Java regression coverage for #23361, whose libcudf fix was implemented in #23462, verifying that unsupported direct Variant casts are rejected for empty inputs.

Testing

Added tests in VariantUtilsTest for logical type mappings, null and malformed inputs, empty inputs and API validation.

  • VariantUtilsTest: 25/25 passed

Checklist

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

@nartal1 nartal1 self-assigned this Aug 20, 2026
@nartal1
nartal1 requested a review from a team as a code owner August 20, 2026 00:09
@nartal1
nartal1 requested a review from ttnghia August 20, 2026 00:09
@nartal1 nartal1 added feature request New feature or request Java Affects Java cuDF API. non-breaking Non-breaking change labels Aug 20, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 20, 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.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b3f6d15d-217e-4300-878d-20eb0483bf53

📥 Commits

Reviewing files that changed from the base of the PR and between fca5013 and a6f3d5c.

📒 Files selected for processing (1)
  • java/src/main/native/src/VariantUtilsJni.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • java/src/main/native/src/VariantUtilsJni.cpp

Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added experimental support for identifying logical types in Variant values.
    • Added APIs to convert between Variant logical types and native identifiers.
    • Added functionality to retrieve Variant type IDs from byte-list columns.
  • Bug Fixes
    • Improved handling of null, empty, sliced, malformed, and all-null Variant inputs.
    • Invalid input types and unsupported conversions now receive appropriate handling.
  • Tests
    • Added comprehensive coverage for type mappings, aliases, edge cases, and native ID conversions.

Walkthrough

The change adds Java bindings for Variant logical type IDs. It defines native ID mappings, exposes VariantUtils.getVariantTypeId, updates the JNI bridge, and adds tests for valid, malformed, null, sliced, empty, and invalid inputs.

Changes

Variant type inspection

Layer / File(s) Summary
Java Variant type contract
java/src/main/java/ai/rapids/cudf/VariantLogicalType.java, java/src/main/java/ai/rapids/cudf/VariantUtils.java
Adds the experimental VariantLogicalType enum, native-ID lookup, and the getVariantTypeId API with its native declaration.
JNI Variant type extraction
java/src/main/native/src/VariantUtilsJni.cpp
Formats the JNI declaration and native call for Variant type-ID extraction.
Variant type-ID validation
java/src/test/java/ai/rapids/cudf/VariantUtilsTest.java
Adds header helpers and tests for logical mappings, malformed values, nulls, slices, empty inputs, invalid inputs, and unsupported casts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to a6f3d

This PR adds Java and JNI support for Variant logical type inspection with API validation and regression coverage; no actionable merge-blocking risk remains.

Suggested reviewers: ttnghia

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The regression test for unsupported direct Variant casts addresses behavior outside the linked issue's logical type inspection scope. Move the unsupported-cast regression test to the owning issue or link the relevant issue to establish its scope.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the requested Java API, matching enum, JNI binding, and test coverage for Variant logical type inspection [#23184].
Title check ✅ Passed The title clearly summarizes the main change: adding Java support for Variant logical type inspection.
Description check ✅ Passed The description directly explains the Java and JNI bindings, API behavior, tests, and regression coverage in the changeset.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@nartal1

nartal1 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a6f3d5c

@gerashegalov gerashegalov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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 Java Affects Java cuDF API. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Java bindings for Parquet VARIANT logical type inspection

2 participants