[FEA] Invalidate io::detail::column_buffer objects when they are converted to columns
#12,367 opened on 2022年12月13日
Repository metrics
- Stars
- (6,000 stars)
- PR merge metrics
- (平均マージ 17d 21h) (30d で 230 merged PRs)
説明
Is your feature request related to a problem? Please describe.
The io::detail::make_column method converts a column_buffer object into a cudf::column. The conversion moves data out from underneath the buffer, invalidating the buffer afterward. As a result, the object should not be used afterwards. At present, however, that information is something that the user has to know a priori. One such example is this finalize_output method in the parquet reader that implicitly handles this logic by only interacting with buffers that would not have been previously modified. It would be better if that information were communicated to the developer more explicitly.
Describe the solution you'd like
After #12364 make_column can be made into a class method. This method should be modified to only be invokable on rvalue-references (see the "member functions with ref-qualifier" section of [the cppreference docs for member functions] on how to do this). That would force calling code to do something like std::move(column_buffer).make_column, making it much more obvious that the buffer is no longer usable afterwards.
Describe alternatives you've considered None
Additional context Making this change will also force careful reconsideration of all code currently using column buffers to ensure that usage patterns are safe. Some patterns may be valid at present (for instance, it looks like some code is currently checking the size of a buffer after its buffers have been moved because the size attribute is still accurate) but are antipatterns that should be refactored.