rapidsai/cudf

[FEA] Invalidate io::detail::column_buffer objects when they are converted to columns

Open

#12 367 ouverte le 13 déc. 2022

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)C++ (735 forks)batch import
0 - BacklogcuIOfeature requestgood first issuelibcudf

Métriques du dépôt

Stars
 (6 000 stars)
Métriques de merge PR
 (Merge moyen 17j 21h) (230 PRs mergées en 30 j)

Description

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.

Guide contributeur