[ 
https://issues.apache.org/jira/browse/ARROW-1689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16217289#comment-16217289
 ] 

ASF GitHub Bot commented on ARROW-1689:
---------------------------------------

wesm commented on a change in pull request #1233: ARROW-1689 Allow User To 
Request No Data Copies
URL: https://github.com/apache/arrow/pull/1233#discussion_r146629402
 
 

 ##########
 File path: python/pyarrow/tests/test_convert_pandas.py
 ##########
 @@ -212,6 +212,18 @@ def test_float_no_nulls(self):
         schema = pa.schema(fields)
         self._check_pandas_roundtrip(df, expected_schema=schema)
 
+    def test_zero_copy_success(self):
+        result = pa.array([0, 1, 2]).to_pandas(zero_copy_only=True)
+        npt.assert_array_equal(result, [0, 1, 2])
+
+    def test_zero_copy_failure_on_object_types(self):
+        with self.assertRaises(pa.ArrowException):
+            pa.array(['A', 'B', 'C']).to_pandas(zero_copy_only=True)
+
+    def test_zero_copy_failure_when_nulls(self):
+        with self.assertRaises(pa.ArrowException):
+            pa.array([0, 1, None]).to_pandas(zero_copy_only=True)
 
 Review comment:
   There are 7 places where a zero copy error is being returned. Let's make 
sure we have unit tests that hit each of them

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [Python] Categorical Indices Should Be Zero-Copy
> ------------------------------------------------
>
>                 Key: ARROW-1689
>                 URL: https://issues.apache.org/jira/browse/ARROW-1689
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>    Affects Versions: 0.7.1
>            Reporter: Nick White
>              Labels: pull-request-available
>
> It seems like 
> [WriteIndices|https://github.com/apache/arrow/blob/0c8b861f93884f2868eb631d8fceee3a8b8905ec/cpp/src/arrow/python/arrow_to_pandas.cc#L955-L981]
>  could reuse some of the logic in 
> [ConvertValuesZeroCopy|https://github.com/apache/arrow/blob/0c8b861f93884f2868eb631d8fceee3a8b8905ec/cpp/src/arrow/python/arrow_to_pandas.cc#L1348-L1385]
>  to avoid copying the integer indices array?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to