Skip to content
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

Python Client import_table Should not also Close the Writer #4777

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions py/client/pydeephaven/_arrow_flight_service.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,9 @@ def import_table(self, data: pa.Table) -> Table:
writer, reader = self._flight_client.do_put(
pa.flight.FlightDescriptor.for_path("export", str(ticket)), dh_schema)
writer.write_table(data)
writer.close()
# Note that pyarrow's write_table completes the gRPC. If we send another gRPC close
# it is possible that by the time the request arrives at the server that it no longer
# knows what it is for and sends a RST_STREAM causing a failure.
_ = reader.read()
flight_ticket = self.session.make_ticket(ticket)
return Table(self.session, ticket=flight_ticket, size=data.num_rows, schema=dh_schema)
@@ -54,7 +56,7 @@ def do_exchange(self):

Returns:
The corresponding Arrow FlightStreamWriter and FlightStreamReader.
"""
"""
try:
desc = pa.flight.FlightDescriptor.for_command(b"dphn")
options = paflight.FlightCallOptions(headers=self.session.grpc_metadata)
@@ -63,4 +65,4 @@ def do_exchange(self):

except Exception as e:
raise DHError("failed to perform a flight DoExchange on the table.") from e