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 struct utility functions. #10776

Merged

Conversation

bdice
Copy link
Contributor

@bdice bdice commented May 3, 2022

This PR adds some struct utility functions. This change is needed for the eventual support of structs in binary operations. See also: PR #9452.

@bdice bdice added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 3, 2022
@bdice bdice self-assigned this May 3, 2022
@bdice bdice requested review from a team as code owners May 3, 2022 19:16
@bdice bdice requested review from robertmaynard and mythrocks May 3, 2022 19:16
@github-actions github-actions bot added CMake CMake build issue libcudf Affects libcudf (C++/CUDA) code. labels May 3, 2022
@bdice bdice changed the title Small changes from #9452. Refactor includes and add struct utilities from #9452. May 3, 2022
@davidwendt
Copy link
Contributor

I don't think you need to change the includes if the header file is in the same directory as the source.
https://github.com/rapidsai/cudf/blob/branch-22.06/cpp/docs/DEVELOPER_GUIDE.md#includes (bullet 4).

@bdice
Copy link
Contributor Author

bdice commented May 3, 2022

I don't think you need to change the includes if the header file is in the same directory as the source. https://github.com/rapidsai/cudf/blob/branch-22.06/cpp/docs/DEVELOPER_GUIDE.md#includes (bullet 4).

@rwlee Is there a reason this change was adopted in #9452? If we prefer to revert these, I can do that. I don't have a strong opinion.

@codecov
Copy link

codecov bot commented May 3, 2022

Codecov Report

Merging #10776 (8ebe02b) into branch-22.06 (a9eb47c) will increase coverage by 0.03%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##           branch-22.06   #10776      +/-   ##
================================================
+ Coverage         86.40%   86.43%   +0.03%     
================================================
  Files               143      143              
  Lines             22448    22448              
================================================
+ Hits              19396    19403       +7     
+ Misses             3052     3045       -7     
Impacted Files Coverage Δ
python/cudf/cudf/testing/_utils.py 93.98% <0.00%> (ø)
python/cudf/cudf/core/dataframe.py 93.74% <0.00%> (+0.04%) ⬆️
python/cudf/cudf/core/column/string.py 89.21% <0.00%> (+0.12%) ⬆️
python/cudf/cudf/core/groupby/groupby.py 91.79% <0.00%> (+0.22%) ⬆️
python/cudf/cudf/core/column/numerical.py 96.17% <0.00%> (+0.29%) ⬆️
python/cudf/cudf/core/tools/datetimes.py 84.49% <0.00%> (+0.30%) ⬆️
python/cudf/cudf/core/column/lists.py 92.91% <0.00%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad12606...8ebe02b. Read the comment docs.

@bdice bdice changed the title Refactor includes and add struct utilities from #9452. Add struct utilities from #9452. May 3, 2022
@bdice
Copy link
Contributor Author

bdice commented May 3, 2022

@davidwendt Good call. I discussed with @rwlee and reverted those changes. I'll also revert them on #9452.

@vyasr
Copy link
Contributor

vyasr commented May 4, 2022

@bdice since the PR note will end up in the Git log, could you write a more descriptive message of the changes? It's much more helpful to see what this PR changes rather than knowing that it was pulled from another PR, especially since that PR will eventually be changed to remove these changes.

@bdice bdice changed the title Add struct utilities from #9452. Add struct utility functions. May 4, 2022
Comment on lines +253 to +254
* and structs containing null values. Null structs add a column to the result of the flatten column
* utility and necessitates column_nullability::FORCE when flattening the column for comparison
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi, given that this is for the legacy flattening, I suspect the need for this function will go away with using the new comparators. It's fine to merge for now, but just keep this in mind.

Comment on lines +444 to +449
bool contains_null_structs(column_view const& col)
{
return (is_struct(col) && col.has_nulls()) ||
std::any_of(col.child_begin(), col.child_end(), contains_null_structs);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this is very short, I wonder why don't we inline it in the header?

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this is very short, I wonder why don't we inline it in the header?

I don't agree with this assessment for moving a function to a header. Moving it to a header may require additional includes in the header that are unnecessary to the caller. I think we should only inline host functions in headers when absolutely necessary. It can improve compile time and also perhaps encapsulation such that changing the implementation (as in this case) would not require recompiling all the source files that include the header.

@bdice
Copy link
Contributor Author

bdice commented May 4, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit d3a39b3 into rapidsai:branch-22.06 May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake CMake build 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.

6 participants