Skip to content

Add DELTA_LENGTH_BYTE_ARRAY encoder and decoder for Parquet - #14590

Merged
rapids-bot[bot] merged 37 commits into
NVIDIA:branch-24.02from
etseidl:dlba_enc_dec
Dec 20, 2023
Merged

rapids-bot[bot] merged 37 commits into
NVIDIA:branch-24.02from
etseidl:dlba_enc_dec

Conversation

@etseidl

@etseidl etseidl commented Dec 6, 2023 •

Copy link
Copy Markdown
Contributor

Description

Part of #13501. This adds the ability to read and write Parquet pages with DELTA_LENGTH_BYTE_ARRAY encoding.

Checklist

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

@copy-pr-bot

copy-pr-bot Bot commented Dec 6, 2023

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 libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API. labels Dec 6, 2023
@etseidl

etseidl commented Dec 6, 2023

Copy link
Copy Markdown
Contributor Author

Unlike past PRs, in this PR I've done both the encoder and decoder. One reason is that the changes here are smaller than in previous delta work. A better reason is that by adding both, I can test the reader and writer at the same time without having to rely on python tests.

That said, this PR does expand the existing python tests anyway...perhaps too much. Reviewers, please let me know if the delta tests in test_parquet.py are a little overboard.

A note on the encoding itself. DELTA_LENGTH_BYTE_ARRAY is much like PLAIN encoding for strings. The difference is that the lengths are encoded first, and then the string data. The theory is that separating the two will lead to better compression. The other difference is that the lengths are DELTA_BINARY_PACKED encoded, so there should be a space savings.

Because the string data is in one big chunk per page, the processing is much simpler than with DELTA_BYTE_ARRAY or even PLAIN. On the decode side, all we need to do is decode the length data into the offsets child column, and then do an exclusive scan on this to turn lengths into offsets. The character data can just be parallel memcpy'd straight into the chars child column. On the encoding side, it's a similar story. First encode the length data, and then memcpy the chars data into the page buffer. Of course, skip_rows complicates things some, but not too much.

@vuule
vuule self-requested a review December 7, 2023 00:05
@vuule vuule added feature request New feature or request cuIO cuIO issue non-breaking Non-breaking change labels Dec 7, 2023
@vuule

vuule commented Dec 7, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@vuule vuule 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.

full pass!

Comment thread cpp/src/io/parquet/page_delta_decode.cu Resolved
Comment thread cpp/src/io/parquet/page_delta_decode.cu Resolved
Comment thread cpp/src/io/parquet/page_enc.cu Resolved
Comment thread cpp/src/io/parquet/page_enc.cu Resolved
Comment thread cpp/src/io/parquet/page_enc.cu Resolved
@ttnghia

ttnghia commented Dec 18, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@vuule
vuule self-requested a review December 19, 2023 19:38
@vuule

vuule commented Dec 19, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@vuule vuule 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.

🔥 🔥

@isVoid isVoid 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.

One small nitpick. Non-blocking.

Comment thread python/cudf/cudf/tests/test_parquet.py Outdated
@pytest.mark.parametrize("add_nulls", [True, False])
@pytest.mark.parametrize("str_encoding", ["DELTA_BYTE_ARRAY"])
def test_delta_byte_array_roundtrip(nrows, add_nulls, str_encoding, tmpdir):
@pytest.mark.parametrize("string_len", [12, 48, 96, 128])

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.

Since this parameter is used for max_string_length below, would suggest keep the name consistent here.

@vuule

vuule commented Dec 20, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@vuule vuule added the 5 - Ready to Merge Testing and reviews complete, ready to merge label Dec 20, 2023
@vuule

vuule commented Dec 20, 2023

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit f1ff424 into NVIDIA:branch-24.02 Dec 20, 2023
@etseidl
etseidl deleted the dlba_enc_dec branch December 20, 2023 23:21
wjxiz1992 added a commit to NVIDIA/cudf-spark that referenced this pull request Sep 7, 2026
…bricks] (#15852)

**JaCoCo production line coverage: +0 lines** (measured: `delta-lake`,
`shuffle-plugin`, `sql-plugin`, `udf-compiler`; shim 350, vs nightly
b19; `delta-lake` report group is stub-only; Iceberg implementation not
loaded/applicable)

Contributes to NVIDIA/cudf#13501.

### Description

Five Parquet V2 encoding fixtures remained xfailed after cuDF added the
corresponding reader support in NVIDIA/cudf#13637, NVIDIA/cudf#14101,
and NVIDIA/cudf#14590. The resolved cudf-spark JNI artifact embeds cuDF
revision `c2c4e85881a52e93e042a59cf88b7633147760c2`, which contains all
three fixes.

This change removes only those five fixture entries from `_xfail_files`.
The existing `test_parquet_testing_valid_files` test continues to
compare CPU and GPU results under both native and Java reader
configurations, recovering 10 test nodes. Other issue-linked xfails in
the shared mapping are unchanged.

Validation:
- Spark 3.5 distribution and integration-test build: all 16 reactor
modules succeeded; `BUILD SUCCESS`.
- Forced pre-edit unmasked run of the five fixtures: `10 passed, 86
deselected, 12 warnings in 7.90s`.
- Focused post-edit run without `--runxfail`: `10 passed, 86 deselected,
12 warnings in 8.91s`.
- Complete `parquet_testing_test.py`: `84 passed, 4 xfailed, 8 xpassed,
90 warnings in 36.49s`.
- All 10 recovered JUnit nodes passed; the plans contained 30
`GpuFileGpuScan` occurrences and no CPU-fallback markers.
- Post-edit exemption scan: zero NVIDIA/cudf#13501 matches; the five
parameter cases are recovered while unrelated shared-map trackers
remain.

AI assistance: The change was prepared with Codex assistance and
reviewed by the author at commit
`ab12239d371d07abdd300422230a81b3eebec0ca` before submission. The PR
description was prepared with Codex assistance.

### Checklists

Documentation
- [ ] Updated for new or modified user-facing features or behaviors
- [x] No user-facing change

Testing
- [x] Added or modified tests to cover new code paths
- [ ] Covered by existing tests
(Please provide the names of the existing tests in the PR description.)
- [ ] Not required

Performance
- [ ] Tests ran and results are added in the PR description
- [ ] Issue filed with a link in the PR description
- [x] Not required

---------

Signed-off-by: Allen Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to Merge Testing and reviews complete, ready to merge cuIO cuIO issue feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants