darklord1807 opened a new issue #11523:
URL: https://github.com/apache/arrow/issues/11523


   Hello, 
   
   I am trying tor read the column data from the CRecordBatch object, but it 
says Object of type 'CRecordBatch' has no attribute 'column_data'. 
   
   **Example.pyx**
   
   ```
   from pyarrow.lib cimport *
   from pyarrow cimport import_pyarrow
   import_pyarrow()
   
   def get_array_length(obj):
       cdef shared_ptr[CRecordBatch] record = pyarrow_unwrap_batch(obj)
       if record.get() == NULL:
           raise TypeError("not a batch")
       return record.get().column_data(1)
   ```
   
   **test.py**
   ```
   batch = pa.RecordBatch.from_pandas(df)
   print(example.get_array_length(batch))
   ```
   
   **Full Error:** 
   
   ```
     tree = Parsing.p_module(s, pxd, full_module_name)
   
   Error compiling Cython file:
   ------------------------------------------------------------
   ...
       cdef shared_ptr[CRecordBatch] record = pyarrow_unwrap_batch(obj)
   
       if record.get() == NULL:
           raise TypeError("not a batch")
   
       return record.get().column_data(1)
                         ^
   ------------------------------------------------------------
   
   example.pyx:15:23: Object of type 'CRecordBatch' has no attribute 
'column_data'
   Traceback (most recent call last):
     File "setup.py", line 9, in <module>
       ext_modules = cythonize("example.pyx")
     File 
"/usr/local/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 
1102, in cythonize
       cythonize_one(*args)
     File 
"/usr/local/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 
1225, in cythonize_one
       raise CompileError(None, pyx_file)
   Cython.Compiler.Errors.CompileError: example.pyx
   ```


-- 
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