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

Fix invalid use of std::exclusive_scan in Parquet writer #13434

Merged
merged 6 commits into from
May 25, 2023

Conversation

etseidl
Copy link
Contributor

@etseidl etseidl commented May 24, 2023

Description

Fixes #13431

Checklist

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

@etseidl etseidl requested a review from a team as a code owner May 24, 2023 17:27
@etseidl etseidl requested review from harrism and divyegala May 24, 2023 17:27
@rapids-bot
Copy link

rapids-bot bot commented May 24, 2023

Pull requests from external contributors require approval from a rapidsai organization member with write or admin permissions before CI can begin.

@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label May 24, 2023
@ttnghia
Copy link
Contributor

ttnghia commented May 24, 2023

/ok to test

@wence- wence- added bug Something isn't working non-breaking Non-breaking change labels May 24, 2023
@@ -1710,10 +1710,10 @@ auto convert_table_to_parquet_data(table_input_metadata& table_meta,
size_type const total_frags = [&]() {
if (frags_per_column.size() > 0) {
std::exclusive_scan(frags_per_column.data(),
frags_per_column.data() + num_columns + 1,
frags_per_column.data() + num_columns,
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use frags_per_column.begin(), frags_per_column.end().

Copy link
Contributor

Choose a reason for hiding this comment

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

Also please avoid back_inserter if possible. So this should be better:

std::vector<size_type> frag_offsets(num_columns, 0);
...
std::exclusive_scan(frags_per_column.begin(), frags_per_column.end(), frag_offsets.begin(), 0);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

much cleaner. thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, the canonical way is to reserve the final size and use back_inserter, so we never reallocate and never default-initialize elements. It is unfortunatelly also the most verbose option 🤷‍♂️
Not a request to apply this here, just an FYI (or maybe a FMI, if @ttnghia knows of a back_inserter drawback).

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 like that. I wouldn't mind changing to that just so it's in my muscle memory :)

@etseidl etseidl requested a review from ttnghia May 24, 2023 18:43
@wence-
Copy link
Contributor

wence- commented May 24, 2023

/ok to test

@ttnghia
Copy link
Contributor

ttnghia commented May 25, 2023

/ok to test

@vuule
Copy link
Contributor

vuule commented May 25, 2023

/merge

@rapids-bot rapids-bot bot merged commit c4f471d into rapidsai:branch-23.06 May 25, 2023
@etseidl etseidl deleted the fix_off_by_one branch May 25, 2023 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] off-by-one in parquet writer fragment offset calc
5 participants