zeroshade commented on code in PR #36009:
URL: https://github.com/apache/arrow/pull/36009#discussion_r1235511108


##########
go/arrow/flight/client.go:
##########
@@ -348,10 +352,87 @@ func (c *client) Authenticate(ctx context.Context, opts 
...grpc.CallOption) erro
        return c.authHandler.Authenticate(ctx, &clientAuthConn{stream})
 }
 
+// Ensure the result of a DoAction is fully consumed
+func ReadUntilEOF(stream FlightService_DoActionClient) error {
+       for {
+               _, err := stream.Recv()
+               if err == io.EOF {
+                       return nil
+               } else if err != nil {
+                       return err
+               }
+       }
+}
+
+func (c *client) CancelFlightInfo(ctx context.Context, info *FlightInfo, opts 
...grpc.CallOption) (result CancelFlightInfoResult, err error) {
+       var action flight.Action
+       action.Type = CancelFlightInfoActionType
+       action.Body, err = proto.Marshal(info)
+       if err != nil {
+               return
+       }
+       stream, err := c.DoAction(ctx, &action, opts...)
+       if err != nil {
+               return
+       }
+       res, err := stream.Recv()
+       if err != nil {
+               return
+       }
+       if err = proto.Unmarshal(res.Body, &result); err != nil {
+               return
+       }
+       err = ReadUntilEOF(stream)
+       return
+}
+
 func (c *client) Close() error {
        c.FlightServiceClient = nil
        if cl, ok := c.conn.(io.Closer); ok {
                return cl.Close()
        }
        return nil
 }
+
+func (c *client) CloseFlightInfo(ctx context.Context, info *FlightInfo, opts 
...grpc.CallOption) (err error) {
+       var action flight.Action
+       action.Type = CloseFlightInfoActionType
+       action.Body, err = proto.Marshal(info)
+       if err != nil {
+               return
+       }
+       stream, err := c.DoAction(ctx, &action, opts...)
+       if err != nil {
+               return
+       }
+       err = ReadUntilEOF(stream)
+       return

Review Comment:
   `return ReadUntilEOF(stream)`?



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