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

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

pitrou commented on a change in pull request #1702: ARROW-2262: [Python] 
Support slicing on pyarrow.ChunkedArray
URL: https://github.com/apache/arrow/pull/1702#discussion_r173120083
 
 

 ##########
 File path: python/pyarrow/table.pxi
 ##########
 @@ -77,6 +77,52 @@ cdef class ChunkedArray:
         self._check_nullptr()
         return self.chunked_array.null_count()
 
+    def __getitem__(self, key):
+        cdef int64_t item
+        cdef int i
+        self._check_nullptr()
+        if isinstance(key, slice):
+            return _normalize_slice(self, key)
+        elif isinstance(key, six.integer_types):
+            item = key
+            if item >= self.chunked_array.length() or item < 0:
+                return IndexError("ChunkedArray selection out of bounds")
 
 Review comment:
   If we allow negative slice bounds, I would expect us to also allow negative 
indices. Seems like it's time for a `_normalize_index` function?

----------------------------------------------------------------
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:
[email protected]


> [Python] Support slicing on pyarrow.ChunkedArray
> ------------------------------------------------
>
>                 Key: ARROW-2262
>                 URL: https://issues.apache.org/jira/browse/ARROW-2262
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: Python
>            Reporter: Uwe L. Korn
>            Assignee: Uwe L. Korn
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to