rdbisme opened a new issue, #14421:
URL: https://github.com/apache/arrow/issues/14421

   Hello, 
   not sure if this is 100% a question for Arrow, but I wanted to experiment a 
bit with Cython, `nogil` and `arrow`. So I started writing a small function 
that uses `GetColumnByName`, that is not exposed for what I can see in 
`https://github.com/apache/arrow/blob/master/python/pyarrow/includes/libarrow.pxd`.
 
   
   ```
   import pyarrow as pa
   
   from libcpp.string cimport string
   from libcpp.memory cimport shared_ptr
   
   from pyarrow.lib cimport CTable, pyarrow_unwrap_table(sa_table)
   
   cdef string SCORES_COLUMN = b"SCORES_COLUMNS"
   
   cdef extern from "arrow/api.h" namespace "arrow" nogil:
       cdef cppclass CTable" arrow::Table":
           shared_ptr[CChunkedArray] GetColumnByName(const string&)
   
   def normalize_sa(sa_table: pa.Table) -> None:
       unwrapped_table: shared_ptr[CTable] = pyarrow_unwrap_table(sa_table)
   
       unwrapped_table.get().GetColumnByName(SCORES_COLUMN)
   
   ```
   
   But when compiling this, I get:
   ```
   Error compiling Cython file:
   ------------------------------------------------------------
   ...
   def normalize_sa(sa_table: pa.Table) -> None:
       unwrapped_table: shared_ptr[CTable] = pyarrow_unwrap_table(sa_table)
   
       unwrapped_table.get().GetColumnByName(SCORES_COLUMN)
                           ^
   ------------------------------------------------------------
   
   src\pkg\cutils\_normalize.pyx:35:25: Object of type 'CTable' has no 
attribute 'GetColumnByName'
   ```
   
   Could you please help me understand why I can't expose `GetColumnByName` or 
why cython can't find it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to