-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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})>") |
Hey @AlenkaF ! Thank you for the comments :) Regarding the formatting: I wanted to stay consistent with other Other than that, I've covered the implementation with tests, as you've suggested. |
9869c14
to
80ab8fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes, the PR is looking great!
I only have one small comment and then that is all from my side.
@pitrou mind giving one more look?
It also looks like the linter needs a change: diff --git a/python/pyarrow/ipc.pxi b/python/pyarrow/ipc.pxi
index c25b2dcab2..565fe3d8fe 100644
--- a/python/pyarrow/ipc.pxi
+++ b/python/pyarrow/ipc.pxi
@@ -335,7 +335,7 @@ cdef class IpcWriteOptions(_Weakrefable):
def __repr__(self):
compression_repr = f"compression=\"{self.compression}\" " \
- if self.compression is not None else ""
+ if self.compression is not None else ""
metadata_version = MetadataVersion(self.metadata_version).name |
…row into apachegh-47358-ipc-flight-repr
Hey @AlenkaF @pitrou @raulcd , thank you for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just a nit on a test which I don't think it's covered.
@github-actions crossbow submit -g python |
Revision: de04f9b Submitted crossbow builds: ursacomputing/crossbow @ actions-71c612bccb |
Thanks for the reviews and the responsive updates! The PR looks much better now. The test-conda-python-emscripten failure seems unrelated. |
@github-actions crossbow submit example-python-minimal-build-* |
Rebase would probably remove the AppVeyor build (failure). |
Revision: 593a0a8 Submitted crossbow builds: ursacomputing/crossbow @ actions-b9c2408cdb
|
Not really, we are waiting for INFRA to remove the integration because the job was migrated so there's no AppVeyor configuration on the repo anymore, see: |
Aha, thanks for the info @raulcd ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
Yes
Are there any user-facing changes?
Nicer representations of the classes mentioned above