jorisvandenbossche commented on code in PR #117:
URL: https://github.com/apache/arrow-nanoarrow/pull/117#discussion_r1132442022
##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -84,3 +85,329 @@ def as_numpy_array(arr):
# TODO set base
return result
+
+
+def version():
+ return ArrowNanoarrowVersion().decode("UTF-8")
+
+cdef class CSchemaHolder:
+ cdef ArrowSchema c_schema
+
+ def __init__(self):
+ self.c_schema.release = NULL
+
+ def __del__(self):
+ if self.c_schema.release != NULL:
+ self.c_schema.release(&self.c_schema)
+
+ def _addr(self):
+ return <uintptr_t>&self.c_schema
+
+cdef class CArrayHolder:
+ cdef ArrowArray c_array
+
+ def __init__(self):
+ self.c_array.release = NULL
+
+ def __del__(self):
+ if self.c_array.release != NULL:
+ self.c_array.release(&self.c_array)
+
+ def _addr(self):
+ return <uintptr_t>&self.c_array
+
+cdef class CArrayViewHolder:
+ cdef ArrowArrayView c_array_view
+
+ def __init__(self):
+ ArrowArrayViewInitFromType(&self.c_array_view,
NANOARROW_TYPE_UNINITIALIZED)
+
+ def __del__(self):
+ ArrowArrayViewReset(&self.c_array_view)
+
+ def _addr(self):
+ return <uintptr_t>&self.c_array_view
+
+cdef class CSchema:
Review Comment:
In pyarrow we have the pattern of calling the exposed C(++) names with a "C"
prefix, and then the corresponding cython classes without.
So the equivalent here would be to use CArrowSchema (instead of ArrowSchema)
for nanoarrow.c one (and so for the declarations in the pxd file), and then
ArrowSchema for the python class here.
I assume that what you describe (CSchema and Schema) can be done in a single
class as well?
--
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]