Skip to content

variant feature branch - #22434

Closed
vuule wants to merge 109 commits into
NVIDIA:mainfrom
vuule:variant-extraction-gpu
Closed

variant feature branch#22434
vuule wants to merge 109 commits into
NVIDIA:mainfrom
vuule:variant-extraction-gpu

Conversation

@vuule

@vuule vuule commented May 8, 2026

Copy link
Copy Markdown
Contributor

Draft PR for variant extraction GPU feature branch.

Made with Cursor

anon and others added 30 commits April 3, 2026 22:48
Implement get_variant_field, cast_variant, and extract_variant_field for
Parquet VARIANT columns (struct<list<uint8> metadata, list<uint8> value>).
Two-pass GPU kernels parse Variant binary encoding on-device: a sizing pass
computes output lengths, followed by an offset scan and a copy pass.

Includes Parquet reader support for the VARIANT logical type, unit tests
(19 cases covering extraction, casting, nulls, edge cases, and Apache
parquet-testing reference vectors), Parquet round-trip tests, and an
NVBench divergence benchmark suite with 5 scenarios isolating dictionary
scan, field scan, and found-vs-null divergence.

Uses create_structs_hierarchy instead of make_structs_column to avoid
expensive superimpose_and_sanitize_nulls when output rows contain nulls.

Made-with: Cursor
Recognize the Parquet VARIANT logical type (union field 16) along with
UUID, FLOAT16, GEOMETRY, and GEOGRAPHY enumerators in the Thrift
compact-protocol reader and writer, and route an unshredded VARIANT
group's `metadata` / `value` BYTE_ARRAY children through the column
buffer as `list<uint8>` via the new
PARQUET_COLUMN_BUFFER_FLAG_VARIANT_BINARY flag.

A VARIANT column read by libcudf surfaces as
`struct<list<uint8> metadata, list<uint8> value>`. Adds pylibcudf
roundtrip tests that build VARIANT parquet files in-memory (PyArrow +
Thrift footer patching) and assert the resulting column shape.

Made-with: Cursor
Replace the in-test PyArrow + Thrift-footer-patch construction with
two committed unshredded VARIANT parquet fixtures under
``python/pylibcudf/tests/io/data/parquet/`` and load them in the
roundtrip test. Drops the encoding helpers from the test module.

Made-with: Cursor
The VARIANT extraction work only needs the reader to recognize the
VARIANT logical type. Drop the unused UUID, FLOAT16, GEOMETRY, and
GEOGRAPHY enumerators and the corresponding writer cases. The reader's
``function_builder`` already silently skips unknown union fields, so
files annotated with those types continue to parse the same way.

Made-with: Cursor
Adds duckdb_variant_sample.parquet (DuckDB-shredded VARIANT layout) and a
test that reads it through pylibcudf and asserts:
- the file reads without error
- top-level id stays INT32
- the VARIANT struct's first two children remain list<uint8> (metadata/value
  pair was flagged correctly by select_columns)
- the struct retains its additional shredded children (sanitize_schema did
  not drop the typed_value subtree)

Also drops the redundant row-count assertion from the unshredded shape test
now that the shredded test covers the metadata/value pair more broadly.

Made-with: Cursor
vuule added 26 commits May 29, 2026 04:44
…ion-gpu

# Conflicts:
#	cpp/include/cudf/io/experimental/variant.hpp
#	cpp/src/io/parquet/experimental/variant_extract.cu
…ion-gpu

Bring in the latest PR 22416 changes (read_uint64 rename, std::format error
helper, refactored read_unquoted_name, doc comments, is_variant_castable
traits, and relocation of variant tests to cpp/tests/io/experimental/).

Conflict resolutions:
- variant_path.cpp: keep the GPU branch's "[N]" array-index parsing while
  adopting pr2's 1-arg read_unquoted_name and std::format-based
  throw_parse_error.
- variant_extract.cu: keep the GPU branch's read_dict_entry + binary-search
  find_key_in_metadata and locate_array_element, adapted to pr2's read_uint64
  rename and non-inline __device__ style; keep pr2's is_variant_int/
  is_variant_castable traits and updated doc comments.
- cpp/tests/CMakeLists.txt: drop the stale io/variant_extract_test.cpp entry
  from the PARQUET_TEST bundle now that pr2 moved the test to its own
  VARIANT_EXTRACT_TEST target under io/experimental/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants