paleolimbot commented on code in PR #117:
URL: https://github.com/apache/arrow-nanoarrow/pull/117#discussion_r1132433740
##########
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:
No good reason! I forget where I got the CSomething pattern (maybe
pyarrow?). After starting with it I thought it might make room for a small
nanoarrow.Schema class that has better autocomplete/is safer (maybe whose
`@property`s are things like `.type`, `.precision`, `.scale`, `.unit`, etc.
instead of the lower-level `.format` and friends). Maybe that is also planning
for something that will never exist, too 🤷
--
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]