Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DELTA_LENGTH_BYTE_ARRAY encoder and decoder for Parquet #14590

Merged
merged 37 commits into from
Dec 20, 2023

Conversation

etseidl
Copy link
Contributor

@etseidl etseidl commented Dec 6, 2023

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 link

copy-pr-bot bot commented Dec 6, 2023

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
Copy link
Contributor Author

etseidl commented Dec 6, 2023

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
Copy link
Contributor

vuule commented Dec 7, 2023

/ok to test

Copy link
Contributor

@vuule vuule left a comment

Choose a reason for hiding this comment

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

full pass!

cpp/src/io/parquet/page_delta_decode.cu Outdated Show resolved Hide resolved
cpp/src/io/parquet/page_delta_decode.cu Show resolved Hide resolved
cpp/src/io/parquet/page_enc.cu Outdated Show resolved Hide resolved
cpp/src/io/parquet/page_enc.cu Outdated Show resolved Hide resolved
cpp/src/io/parquet/page_enc.cu Outdated Show resolved Hide resolved
cpp/src/io/parquet/page_string_decode.cu Outdated Show resolved Hide resolved
@ttnghia
Copy link
Contributor

ttnghia commented Dec 18, 2023

/ok to test

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

vuule commented Dec 19, 2023

/ok to test

Copy link
Contributor

@vuule vuule left a comment

Choose a reason for hiding this comment

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

🔥 🔥

Copy link
Contributor

@isVoid isVoid left a comment

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.

@@ -1352,8 +1352,13 @@ def test_delta_binary(nrows, add_nulls, dtype, tmpdir):

@pytest.mark.parametrize("nrows", delta_num_rows())
@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
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
Copy link
Contributor

vuule commented Dec 20, 2023

/ok to test

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

vuule commented Dec 20, 2023

/merge

@rapids-bot rapids-bot bot merged commit f1ff424 into rapidsai:branch-24.02 Dec 20, 2023
67 checks passed
@etseidl etseidl deleted the dlba_enc_dec branch December 20, 2023 23:21
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
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants