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

Eduardo Ponce edited comment on ARROW-14449 at 10/22/21, 9:21 PM:
------------------------------------------------------------------

One solution that does not requires any modification to current Arrow/Cython is 
to first retrieve an _Array_ via _column()_ and then get the _ArrayData_ via 
the _data()_ method.

{code:python}
cdef:
    shared_ptr[CRecordBatch] record = pyarrow_unwrap_batch(obj)
    shared_ptr[CArray] array
    shared_ptr[CArrayData] data
if record.get() == NULL:
    raise TypeError("not a batch")
array = record.get().column(1)
data = array.get().data()
{code}


was (Author: edponce):
One solution that does not requires any modification to current Arrow/Cython is 
to first retrieve an _Array_ via _column()_ and then get the _ArrayData_ via 
the _data()_ method.

{code:python}
cdef shared_ptr[CRecordBatch] record = pyarrow_unwrap_batch(obj)
array_data = record.get().column(1).data()
{code}

> [Python] RecordBatch in Cython is missing column_data method
> ------------------------------------------------------------
>
>                 Key: ARROW-14449
>                 URL: https://issues.apache.org/jira/browse/ARROW-14449
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Eduardo Ponce
>            Assignee: Eduardo Ponce
>            Priority: Major
>             Fix For: 7.0.0
>
>
> From GitHub issue: [https://github.com/apache/arrow/issues/11523]
> [RecordBatch in 
> Cython|https://github.com/apache/arrow/blob/master/python/pyarrow/table.pxi#L635]
>  is missing the [*column_data* 
> method|https://github.com/apache/arrow/blob/master/cpp/src/arrow/record_batch.h#L107].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to