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

Allow ORC and Parquet writers to write nullable columns without nulls as non-nullable #13675

Merged

Conversation

vuule
Copy link
Contributor

@vuule vuule commented Jul 7, 2023

Description

Issue #7654, #13010

Writers have a strict check for nullability when applying the user metadata's nullability options, because checking the actual number of nulls is (was) not cheap.
Since we now create all columns with a known number of nulls, the null_count check became cheap and we have no reason to prevent columns without nulls to be written as non-nullable.
This PR changes the condition to allow this case.
The PR does not address the issue with sliced columns, where it's not possible to write sliced column as non-nullable, even if the slice has no nulls. That check is still not cheap :)

Checklist

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

@vuule vuule added cuIO cuIO issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jul 7, 2023
@vuule vuule self-assigned this Jul 7, 2023
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label Jul 7, 2023
@vuule vuule marked this pull request as ready for review July 10, 2023 17:18
@vuule vuule requested a review from a team as a code owner July 10, 2023 17:18
@vuule vuule requested review from harrism and nvdbaranec July 10, 2023 17:18
cudf::io::orc_writer_options::builder(cudf::io::sink_info{filepath}, expected)
.metadata(&expected_metadata);
// Writer should be able to write a column without nulls as non-nullable
EXPECT_NO_THROW(cudf::io::write_orc(out_opts));
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit, either way is fine, but I don't think EXPECT_NO_THROW is required. If it throws and the exception is not caught, the test fails anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use it just to make it easier to see what we're checking. I prefer to have the macro for this reason.

@vuule
Copy link
Contributor Author

vuule commented Jul 12, 2023

/merge

@rapids-bot rapids-bot bot merged commit dc6aefb into rapidsai:branch-23.08 Jul 12, 2023
@vuule vuule deleted the fea-write-no-nulls-as-non-nullable branch July 12, 2023 01:01
@vuule vuule restored the fea-write-no-nulls-as-non-nullable branch August 10, 2023 03:13
@vuule vuule deleted the fea-write-no-nulls-as-non-nullable branch August 10, 2023 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuIO cuIO issue improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants