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


##########
python/src/nanoarrow/schema.py:
##########
@@ -299,160 +280,627 @@ def __arrow_c_schema__(self):
         return self._c_schema.__arrow_c_schema__()
 
 
-def null(nullable=True) -> Schema:
-    """Create an instance of a null type."""
+def schema(obj, *, name=None, nullable=None, **params):
+    """Create a nanoarrow Schema
+
+    The Schema is nanoarrow's high-level data type representation, encompasing
+    the role of PyArrow's ``Schema``, ``Field``, and ``DataType``. This scope
+    maps to that of the ArrowSchema in the Arrow C Data interface.
+
+    Parameters
+    ----------
+    obj :
+        A :class:`Type` specifier or an schema-like object. A schema-like 
object
+        includes:
+        * A ``pyarrow.Schema``, `pyarrow.Field``, or ``pyarrow.DataType``
+        * A nanoarrow :class:`Schema`, :class:`CSchema`, or :class:`Type`
+        * Any object implementing the Arrow PyCapsule interface
+          ``__arrow_c_schema__()`` protocol method.
+
+    name : str, optional
+        An optional name to bind to this field.
+
+    nullable : bool, optional
+        Explicitly specify field nullability. Fields are nullable by default.
+        Not supported of ``obj`` is anything other than a :class:`Type` object.

Review Comment:
   ```suggestion
           Only supported if ``obj`` is a :class:`Type` object (for any other 
input, the nullability is preserved from the passed object).
   ```



##########
python/src/nanoarrow/schema.py:
##########
@@ -299,160 +280,627 @@ def __arrow_c_schema__(self):
         return self._c_schema.__arrow_c_schema__()
 
 
-def null(nullable=True) -> Schema:
-    """Create an instance of a null type."""
+def schema(obj, *, name=None, nullable=None, **params):
+    """Create a nanoarrow Schema
+
+    The Schema is nanoarrow's high-level data type representation, encompasing
+    the role of PyArrow's ``Schema``, ``Field``, and ``DataType``. This scope
+    maps to that of the ArrowSchema in the Arrow C Data interface.
+
+    Parameters
+    ----------
+    obj :
+        A :class:`Type` specifier or an schema-like object. A schema-like 
object
+        includes:
+        * A ``pyarrow.Schema``, `pyarrow.Field``, or ``pyarrow.DataType``
+        * A nanoarrow :class:`Schema`, :class:`CSchema`, or :class:`Type`
+        * Any object implementing the Arrow PyCapsule interface
+          ``__arrow_c_schema__()`` protocol method.
+
+    name : str, optional
+        An optional name to bind to this field.
+
+    nullable : bool, optional
+        Explicitly specify field nullability. Fields are nullable by default.
+        Not supported of ``obj`` is anything other than a :class:`Type` object.
+
+    **params
+        Type-specific parameters when ``obj`` os a :class:`Type`.

Review Comment:
   ```suggestion
           Type-specific parameters when ``obj`` is a :class:`Type`.
   ```



##########
python/src/nanoarrow/schema.py:
##########
@@ -214,18 +255,18 @@ def scale(self) -> int:
         return self._c_schema_view.decimal_scale
 
     @property
-    def n_children(self) -> int:
+    def n_fields(self) -> int:

Review Comment:
   Is there a specific reason you switched from "children" to "fields"? (the 
spec speaks about "children", I think?)



##########
python/src/nanoarrow/schema.py:
##########
@@ -299,160 +280,627 @@ def __arrow_c_schema__(self):
         return self._c_schema.__arrow_c_schema__()
 
 
-def null(nullable=True) -> Schema:
-    """Create an instance of a null type."""
+def schema(obj, *, name=None, nullable=None, **params):
+    """Create a nanoarrow Schema
+
+    The Schema is nanoarrow's high-level data type representation, encompasing
+    the role of PyArrow's ``Schema``, ``Field``, and ``DataType``. This scope
+    maps to that of the ArrowSchema in the Arrow C Data interface.
+
+    Parameters
+    ----------
+    obj :
+        A :class:`Type` specifier or an schema-like object. A schema-like 
object

Review Comment:
   ```suggestion
           A :class:`Type` specifier or a schema-like object. A schema-like 
object
   ```



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