Skip to content

[REVIEW] Remove null_count() and has_nulls() from column_device_view. #4799

Merged
trevorsm7 merged 8 commits intorapidsai:branch-0.14from
nvdbaranec:remove_cdv_null_count
Apr 10, 2020
Merged

[REVIEW] Remove null_count() and has_nulls() from column_device_view. #4799
trevorsm7 merged 8 commits intorapidsai:branch-0.14from
nvdbaranec:remove_cdv_null_count

Conversation

@nvdbaranec
Copy link
Copy Markdown
Contributor

Closes #4368

The main noteworthy thing in this PR is the removal of an exception in the constructor of value_accessor. This does add some mild danger, but after internal discussions, it was decided to be reasonable.

… several places that were

using it to use the source column_view instead.
@nvdbaranec nvdbaranec requested a review from a team as a code owner April 3, 2020 22:24
@GPUtester
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2020

Codecov Report

Merging #4799 into branch-0.14 will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           branch-0.14    #4799      +/-   ##
===============================================
+ Coverage        88.51%   88.58%   +0.06%     
===============================================
  Files               51       50       -1     
  Lines             9869     9797      -72     
===============================================
- Hits              8736     8679      -57     
+ Misses            1133     1118      -15     
Impacted Files Coverage Δ
python/dask_cudf/dask_cudf/core.py 72.14% <0.00%> (-0.28%) ⬇️
python/cudf/cudf/core/dataframe.py 89.49% <0.00%> (-0.04%) ⬇️
python/dask_cudf/dask_cudf/accessor.py
python/cudf/cudf/core/column_accessor.py 93.12% <0.00%> (+0.62%) ⬆️

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 92733e2...8ed35ae. Read the comment docs.

Copy link
Copy Markdown
Contributor

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

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

I think it's worth documenting somewhere on the column_device_view why it doesn't have a null_count member when both column and column_view do. Say something about how this information isn't needed in device code (where column_device_view is intended to be used), and is otherwise available from the column_view.

…unt() or has_nulls().

Updated copyright dates on a number of files.
Copy link
Copy Markdown
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

Looks good. Just need to change some c-style casts to c++-style.

: detail::column_device_view_base{source.type(), source.size(),
source.head(), source.null_mask(),
source.null_count(), source.offset()},
source.offset()},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@nvdbaranec I think you incorrectly resolved conflicts in this file when you merged branch-0.14. It seems @davidwendt's PR #4783 moved the contents of this constructor into a helper function and moved this constructor later in the file. I just tried to resolve conflicts on this PR (4799) and found it very confusing because of those changes. Please go back and fix up the merge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This wasn't a bad local merge. That PR (4783) just got commited at an unfortunate time (after the last update to this got pushed). Updated.

@trevorsm7 trevorsm7 merged commit 485e4d9 into rapidsai:branch-0.14 Apr 10, 2020
Copy link
Copy Markdown
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

Thanks, looks good.

rapids-bot bot pushed a commit that referenced this pull request Feb 27, 2026
Adds the `null_count()` member function back to the `cudf::column_device_view` class.
This member function was removed in #4799 because the null count was unreliable since it could be set to `UNKNOWN_NULL_COUNT`. The `UNKNOWN_NULL_COUNT`  was removed in #13372 so this should no longer be an issue.

Although the value is now more reliable it is just a copy at the time the `cudf::column_device_view` was created so it is not without caveats though these are easily explained and hopefully understood. The value is much less reliable on `cudf::mutable_column_device_view` where the null-mask is more likely modified rendering the count invalid. Therefore, the `null_count()` is added only to the immutable `cudf::column_device_view`.

The growing number of changes to move template parameters like `has_nulls` to runtime parameters reduces unneeded kernel compilations. Here is one example where having this member function would've helped to reduce the function parameters and more clearly identify the `has_nulls` parameter directly correlates to the `input` parameter state:
https://github.com/rapidsai/cudf/blob/609b08e2c8075cad12347cede69d195fa5b186f1/cpp/src/rolling/detail/rolling_operators.cuh#L399-L416

Note the `has_nulls` parameter would not be needed since the `input` could contain this information and more clearly show what the parameter is based on.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)
  - Nghia Truong (https://github.com/ttnghia)
  - Muhammad Haseeb (https://github.com/mhaseeb123)

URL: #21430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Remove null count from column_device_view

6 participants