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


##########
go/arrow/flight/flightsql/server.go:
##########
@@ -927,10 +937,78 @@ func (f *flightSqlServer) ListActions(_ *flight.Empty, 
stream flight.FlightServi
        return nil
 }
 
+func cancelStatusToCancelResult(status flight.CancelStatus) CancelResult {
+       switch status {
+       case flight.CancelStatusUnspecified:
+               return CancelResultUnspecified
+       case flight.CancelStatusCancelled:
+               return CancelResultCancelled
+       case flight.CancelStatusCancelling:
+               return CancelResultCancelling
+       case flight.CancelStatusNotCancellable:
+               return CancelResultNotCancellable
+       default:
+               return CancelResultUnspecified
+       }
+}
+
 func (f *flightSqlServer) DoAction(cmd *flight.Action, stream 
flight.FlightService_DoActionServer) error {
        var anycmd anypb.Any
 
        switch cmd.Type {
+       case flight.CancelFlightInfoActionType:
+               var (
+                       info   flight.FlightInfo
+                       result flight.CancelFlightInfoResult
+                       err    error
+               )
+
+               if err = proto.Unmarshal(cmd.Body, &info); err != nil {
+                       return status.Errorf(codes.InvalidArgument, "unable to 
unmarshal FlightInfo for CancelFlightInfo: %s", err.Error())
+               }
+
+               if result, err = f.srv.CancelFlightInfo(stream.Context(), 
&info); err != nil {
+                       return err
+               }

Review Comment:
   you can add a check here if `f.srv` implements the `CancelQuery` method to 
call it instead of `CancelFlightInfo`.
   
   ```go
   type cancelquery interface {
            CancelQuery(context.Context, ActionCancelQueryRequest) 
(CancelResult, error)
   }
   
   if cancel, ok := f.srv.(cancelquery); ok {
           cancelResult, err := cancel(stream.Context(), ......)
           if err != nil {
                     return err
            }
            result = ....
   } else {
            if result, err = f.srv.CancelFlightInfo(stream.Context(), &info); 
err != nil {
                    return err
             }
   }
   ```
   
   Or something like that.



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