kou commented on code in PR #37218:
URL: https://github.com/apache/arrow/pull/37218#discussion_r1296620274


##########
python/pyarrow/gandiva.pyx:
##########
@@ -328,6 +428,17 @@ cdef class TreeExprBuilder(_Weakrefable):
         return Node.create(r)
 
     def make_or(self, children):
+        """
+        Create a Node with a boolean OR expression.
+
+        Parameters
+        ----------
+        children : pyarrow.gandiva.NodeVector

Review Comment:
   ```suggestion
           children : list[pyarrow.gandiva.Node]
   ```



##########
python/pyarrow/gandiva.pyx:
##########
@@ -307,17 +371,53 @@ cdef class TreeExprBuilder(_Weakrefable):
         return Node.create(r)
 
     def make_field(self, Field field not None):
+        """
+        Create a node with an arrow field.

Review Comment:
   ```suggestion
           Create a node with an Arrow field.
   ```



##########
python/pyarrow/gandiva.pyx:
##########
@@ -307,17 +371,53 @@ cdef class TreeExprBuilder(_Weakrefable):
         return Node.create(r)
 
     def make_field(self, Field field not None):
+        """
+        Create a node with an arrow field.
+
+        Parameters
+        ----------
+        field : Field
+
+        Returns
+        -------
+        pyarrow.gandiva.Node
+        """
         cdef shared_ptr[CNode] r = TreeExprBuilder_MakeField(field.sp_field)
         return Node.create(r)
 
     def make_if(self, Node condition not None, Node this_node not None,
                 Node else_node not None, DataType return_type not None):
+        """
+        Create a node with an if-else expression.
+
+        Parameters
+        ----------
+        condition : pyarrow.gandiva.Node
+        this_node : pyarrow.gandiva.Node
+        else_node : pyarrow.gandiva.Node
+        return_type : DataType
+
+        Returns
+        -------
+        pyarrow.gandiva.Node
+        """
         cdef shared_ptr[CNode] r = TreeExprBuilder_MakeIf(
             condition.node, this_node.node, else_node.node,
             return_type.sp_type)
         return Node.create(r)
 
     def make_and(self, children):
+        """
+        Create a Node with a boolean AND expression.
+
+        Parameters
+        ----------
+        children : pyarrow.gandiva.NodeVector

Review Comment:
   ```suggestion
           children : list[pyarrow.gandiva.Node]
   ```



##########
python/pyarrow/tensor.pxi:
##########
@@ -1040,6 +1078,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCSFTensor
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional
+            Names of the dimensions.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/tensor.pxi:
##########
@@ -316,6 +316,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCOOTensor
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional

Review Comment:
   ```suggestion
           dim_names : list[str], optional
   ```



##########
python/pyarrow/gandiva.pyx:
##########
@@ -307,17 +371,53 @@ cdef class TreeExprBuilder(_Weakrefable):
         return Node.create(r)
 
     def make_field(self, Field field not None):
+        """
+        Create a node with an arrow field.
+
+        Parameters
+        ----------
+        field : Field

Review Comment:
   ```suggestion
           field : pyarrow.Field
   ```



##########
python/pyarrow/array.pxi:
##########
@@ -1265,6 +1265,17 @@ cdef class Array(_PandasConvertible):
         return frombytes(result, safe=True)
 
     def format(self, **kwargs):
+        """
+        DEPRECATED, use Array.to_string

Review Comment:
   ```suggestion
           DEPRECATED, use pyarrow.Array.to_string
   ```



##########
python/pyarrow/tensor.pxi:
##########
@@ -316,6 +316,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCOOTensor
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional
+            Names of the dimensions.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/tensor.pxi:
##########
@@ -816,6 +839,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCSCMatrix
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional

Review Comment:
   ```suggestion
           dim_names : list[str], optional
   ```



##########
python/pyarrow/tensor.pxi:
##########
@@ -1040,6 +1078,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCSFTensor
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional

Review Comment:
   ```suggestion
           dim_names : list[str], optional
   ```



##########
python/pyarrow/tensor.pxi:
##########
@@ -997,6 +1027,14 @@ shape: {0.shape}""".format(self)
         return self.stp.size()
 
     def dim_name(self, i):
+        """
+        Returns the name of the i-th tensor dimension.
+
+        Parameters
+        ----------
+        i : int
+            The physical index of the tensor dimension.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/tensor.pxi:
##########
@@ -781,6 +796,14 @@ shape: {0.shape}""".format(self)
         return self.stp.size()
 
     def dim_name(self, i):
+        """
+        Returns the name of the i-th tensor dimension.
+
+        Parameters
+        ----------
+        i : int
+            The physical index of the tensor dimension.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/_parquet.pyx:
##########
@@ -1183,6 +1183,22 @@ cdef class ParquetReader(_Weakrefable):
              FileDecryptionProperties decryption_properties=None,
              thrift_string_size_limit=None,
              thrift_container_size_limit=None):
+        """
+        Open a parquet file for reading.
+
+        Parameters
+        ----------
+        source : object

Review Comment:
   ```suggestion
           source : str, pyarrow.Buffer, pyarrow.NativeFile or Python's IO 
objects (Sorry. I don't know how to say about them...)
   ```



##########
python/pyarrow/types.pxi:
##########
@@ -1925,9 +1943,27 @@ cdef class KeyValueMetadata(_Metadata, Mapping):
         return KeyValueMetadata, (list(self.items()),)
 
     def key(self, i):
+        """
+        Parameters
+        ----------
+        i : int
+
+        Returns
+        -------
+        str

Review Comment:
   `byte`?
   
   ```suggestion
           byte
   ```



##########
python/pyarrow/io.pxi:
##########
@@ -865,12 +881,35 @@ cdef class PythonFile(NativeFile):
             self.is_writable = True
 
     def truncate(self, pos=None):
+        """
+        Parameters
+        ----------
+        pos : int, optional
+        """
         self.handle.truncate(pos)
 
     def readline(self, size=None):
+        """
+        Read and return a line of bytes from the file.
+
+        If size is specified, read at most size bytes.
+
+        Parameters
+        ----------
+        size : int
+            maximum number of bytes read
+        """
         return self.handle.readline(size)
 
     def readlines(self, hint=None):
+        """
+        Read lines of the file.
+
+        Parameters
+        ----------
+        hint : int
+            maximum number of bytes read until we stop

Review Comment:
   ```suggestion
               Maximum number of bytes read until we stop
   ```



##########
python/pyarrow/tensor.pxi:
##########
@@ -1190,6 +1235,14 @@ shape: {0.shape}""".format(self)
         return self.stp.size()
 
     def dim_name(self, i):
+        """
+        Returns the name of the i-th tensor dimension.
+
+        Parameters
+        ----------
+        i : int
+            The physical index of the tensor dimension.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/tensor.pxi:
##########
@@ -816,6 +839,13 @@ shape: {0.shape}""".format(self)
     def from_dense_numpy(cls, obj, dim_names=None):
         """
         Convert numpy.ndarray to arrow::SparseCSCMatrix
+
+        Parameters
+        ----------
+        obj : numpy.ndarray
+            Data used to populate the rows.
+        dim_names : list, optional
+            Names of the dimensions.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/tensor.pxi:
##########
@@ -549,6 +556,14 @@ shape: {0.shape}""".format(self)
         return self.stp.size()
 
     def dim_name(self, i):
+        """
+        Returns the name of the i-th tensor dimension.
+
+        Parameters
+        ----------
+        i : int
+            The physical index of the tensor dimension.

Review Comment:
   Do we need to write `Returns` here?



##########
python/pyarrow/io.pxi:
##########
@@ -865,12 +881,35 @@ cdef class PythonFile(NativeFile):
             self.is_writable = True
 
     def truncate(self, pos=None):
+        """
+        Parameters
+        ----------
+        pos : int, optional
+        """
         self.handle.truncate(pos)
 
     def readline(self, size=None):
+        """
+        Read and return a line of bytes from the file.
+
+        If size is specified, read at most size bytes.
+
+        Parameters
+        ----------
+        size : int
+            maximum number of bytes read

Review Comment:
   ```suggestion
               Maximum number of bytes read
   ```



##########
python/pyarrow/types.pxi:
##########
@@ -1925,9 +1943,27 @@ cdef class KeyValueMetadata(_Metadata, Mapping):
         return KeyValueMetadata, (list(self.items()),)
 
     def key(self, i):
+        """
+        Parameters
+        ----------
+        i : int
+
+        Returns
+        -------
+        str
+        """
         return self.metadata.key(i)
 
     def value(self, i):
+        """
+        Parameters
+        ----------
+        i : int
+
+        Returns
+        -------
+        Any

Review Comment:
   `byte`?
   
   ```suggestion
           byte
   ```



##########
python/pyarrow/types.pxi:
##########
@@ -1943,6 +1979,15 @@ cdef class KeyValueMetadata(_Metadata, Mapping):
             yield (self.metadata.key(i), self.metadata.value(i))
 
     def get_all(self, key):
+        """
+        Parameters
+        ----------
+        key : str
+
+        Returns
+        -------
+        list

Review Comment:
   ```suggestion
           list[byte]
   ```



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