Add allow_copy flag to interchange protocol#51
Merged
rgommers merged 5 commits intodata-apis:mainfrom Aug 24, 2021
Merged
Conversation
This PR adds a flag to throw an exception if the export cannot be zero-copy. (e.g. for pandas, possible due to block manager where rows are contiguous and columns are not) . - Add `allow_zero_copy` flag to the DataFrame class. - Propagate the flag to the buffer and raise a `RuntimeError` when it is true - Fix `test_noncontiguous_columns` - Make update in the requirements doc
kgryte
approved these changes
Aug 23, 2021
Contributor
kgryte
left a comment
There was a problem hiding this comment.
LGTM. Nothing obvious jumps out at me. One minor clarification question left in the review regarding when we're choosing to pass allow_copy.
| elif self.dtype[0] == _k.CATEGORICAL: | ||
| codes = self._col.values.codes | ||
| buffer = _PandasBuffer(codes) | ||
| buffer = _PandasBuffer( |
Contributor
There was a problem hiding this comment.
As a sanity check, we're not similarly passing allow_copy at L595, L634, and L676 because we have guaranteed contiguous buffers in those cases?
Member
Author
There was a problem hiding this comment.
Yes indeed. np.asarray(some_list) creates a new contiguous array, and the bytearray usage seems to be contiguous too (that one was a bit harder to verify, but I did test it).
Member
Author
|
Okay, in it goes then. Thanks for verifying @kgryte |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebase and fix up of gh-44.