paleolimbot commented on code in PR #366:
URL: https://github.com/apache/arrow-nanoarrow/pull/366#discussion_r1463851326


##########
python/src/nanoarrow/_lib.pyx:
##########
@@ -478,6 +593,130 @@ cdef class CSchemaView:
     def __repr__(self):
         return _lib_utils.schema_view_repr(self)
 
+
+cdef class CSchemaBuilder:
+    cdef CSchema c_schema
+    cdef ArrowSchema* _ptr
+
+    def __cinit__(self, CSchema schema):
+        self.c_schema = schema
+        self._ptr = schema._ptr
+        if self._ptr.release == NULL:
+            ArrowSchemaInit(self._ptr)
+
+    @staticmethod
+    def allocate():
+        return CSchemaBuilder(CSchema.allocate())
+
+    def child(self, int64_t i):
+        return CSchemaBuilder(self.c_schema.child(i))
+
+    def set_type(self, int type):
+        self.c_schema._assert_valid()
+
+        cdef int result = ArrowSchemaSetType(self._ptr, <ArrowType>type)
+        if result != NANOARROW_OK:
+            Error.raise_error("ArrowSchemaSetType()", result)
+
+        return self
+
+    def set_type_decimal(self, int type, int precision, int scale):

Review Comment:
   Good call! I updated these to `type_id`.



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