You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "pitrou (via GitHub)" <gi...@apache.org> on 2025/09/01 13:41:41 UTC

Re: [PR] GH-47358: [Python] IPC and Flight options representation [arrow]

pitrou commented on PR #47461:
URL: https://github.com/apache/arrow/pull/47461#issuecomment-3242432530

   > I've started implementing the `__repr__` dunders for the classes that you've mentioned in #47358, however, now I stumbled upon `FlightCallOptions`'s arguments not being convertable back to Python objects after they are set as C objects inside `FlightCallOptions.options`.
   
   I'm not sure what you mean, because if you define the `__repr__` in Cython you should be able to access the C-level attributes. You may need to add the necessary API declarations for C++ Flight types.
   
   For example, this examples works for me:
   ```patch
   diff --git a/python/pyarrow/_flight.pyx b/python/pyarrow/_flight.pyx
   index fe2e1b3d67..ca842f35bb 100644
   --- a/python/pyarrow/_flight.pyx
   +++ b/python/pyarrow/_flight.pyx
   @@ -142,6 +142,10 @@ cdef class FlightCallOptions(_Weakrefable):
                return &((<FlightCallOptions> obj).options)
            raise TypeError(f"Expected a FlightCallOptions object, not '{type(obj)}'")
    
   +    def __repr__(self):
   +        # Draft implementation, should be improved
   +        return f'FlightCallOptions(timeout={self.options.timeout.count()})'
   +
    
    _CertKeyPair = collections.namedtuple('_CertKeyPair', ['cert', 'key'])
    
   diff --git a/python/pyarrow/includes/libarrow_flight.pxd b/python/pyarrow/includes/libarrow_flight.pxd
   index b1af6bcb4f..f2b15fb706 100644
   --- a/python/pyarrow/includes/libarrow_flight.pxd
   +++ b/python/pyarrow/includes/libarrow_flight.pxd
   @@ -272,6 +272,7 @@ cdef extern from "arrow/flight/api.h" namespace "arrow" nogil:
    
        cdef cppclass CTimeoutDuration" arrow::flight::TimeoutDuration":
            CTimeoutDuration(double)
   +        double count()
    
        cdef cppclass CFlightCallOptions" arrow::flight::FlightCallOptions":
            CFlightCallOptions()
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org