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


##########
go/arrow/flight/flightsql/client.go:
##########
@@ -500,6 +522,11 @@ func (c *Client) CancelQuery(ctx context.Context, info 
*flight.FlightInfo, opts
                return
        }
        defer stream.CloseSend()
+       defer func() {
+               // XXX: assuming server will not return a result and then an 
error
+               // (or else we need to also try to clean up stmt)
+               err = readUntilEOF(stream)
+       }()

Review Comment:
   rather than defer this, why not just do it manually after the next if 
statement?



##########
go/arrow/flight/flightsql/client.go:
##########
@@ -396,6 +408,11 @@ func (c *Client) Prepare(ctx context.Context, query 
string, opts ...grpc.CallOpt
                return
        }
        defer stream.CloseSend()
+       defer func() {
+               // XXX: assuming server will not return a result and then an 
error
+               // (or else we need to also try to clean up stmt)
+               err = readUntilEOF(stream)
+       }()

Review Comment:
   would it make more sense to put this into `parsePreparedStatementResponse` 
and get it for free in all the spots that just delegate to it?



##########
go/arrow/flight/flightsql/client.go:
##########
@@ -806,10 +845,7 @@ func (tx *Txn) Rollback(ctx context.Context, opts 
...grpc.CallOption) error {
        }
 
        tx.txn = nil
-       if _, err = stream.Recv(); err == io.EOF {
-               err = nil
-       }
-
+       err = readUntilEOF(stream)
        return err

Review Comment:
   same as above



##########
go/arrow/flight/flightsql/client.go:
##########
@@ -775,9 +816,7 @@ func (tx *Txn) Commit(ctx context.Context, opts 
...grpc.CallOption) error {
        }
 
        tx.txn = nil
-       if _, err = stream.Recv(); err == io.EOF {
-               err = nil
-       }
+       err = readUntilEOF(stream)
        return err

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