-
Notifications
You must be signed in to change notification settings - Fork 3.8k
GH-47358: [Python] IPC and Flight options representation #47461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
hey @pitrou, I hope you're doing well :) |
I'm not sure what you mean, because if you define the For example, this change works for me: 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() |
Hm, that's interesting, since the same changes have segfaulted for me 🤔 |
hi @pitrou, I have implemented |
Thank you for another contribution @rmnskb ! The overall approach looks good to me. I like that you're only appending the read and write options when they're defined. I think we don’t currently have One request from me — it would be great to add One very minor nit: stylistically, I’d consider adding the parentheses inside the class name in the def __repr__(self):
return (f"<pyarrow.ipc.IpcReadOptions ("
...
f"included_fields={self.included_fields})>") |
Rationale for this change
Please see #47358
What changes are included in this PR?
Added
__repr__
dunder methods toipc.IpcWriteOptions
,ipc.IpcReadOptions
andflight.FlightCallOptions
Are these changes tested?
No
Are there any user-facing changes?
Nicer representations of the classes mentioned above