ennuite commented on code in PR #732:
URL: https://github.com/apache/arrow-go/pull/732#discussion_r3517096791


##########
arrow/flight/flightsql/server_test.go:
##########
@@ -133,6 +133,78 @@ func (*testServer) DoGetStatement(ctx context.Context, 
ticket flightsql.Statemen
        return
 }
 
+func (*testServer) CreatePreparedStatement(ctx context.Context, req 
flightsql.ActionCreatePreparedStatementRequest) (result 
flightsql.ActionCreatePreparedStatementResult, err error) {
+       query := req.GetQuery()
+       var isUpdate *bool
+       result.Handle = []byte(query)
+       switch query {
+       case "prepared query":
+               isUpdate := false
+               result.IsUpdate = &isUpdate
+       case "prepared update":
+               isUpdate := true
+               result.IsUpdate = &isUpdate
+       default:
+               err = fmt.Errorf("unknown query: %s", query)
+       }
+       if isUpdate != nil {

Review Comment:
   Thank you for this review. 
   Addressed in 
https://github.com/apache/arrow-go/pull/732/commits/346696955e501cdce0f575f2bd42fda894c621e4



##########
arrow/flight/flightsql/client.go:
##########
@@ -1348,6 +1351,11 @@ func (p *PreparedStatement) DatasetSchema() 
*arrow.Schema { return p.datasetSche
 // the prepared statement.
 func (p *PreparedStatement) ParameterSchema() *arrow.Schema { return 
p.paramSchema }
 
+// IsUpdate returns the server's hint about whether this prepared statement
+// should be executed as an update (true) or query (false). If nil, the server
+// did not provide a hint and the client can choose how to execute the 
statement.
+func (p *PreparedStatement) IsUpdate() *bool { return p.isUpdate }

Review Comment:
   Thank you for pointing this out. I took the idiomatic approach with the 
double boolean return, see 
https://github.com/apache/arrow-go/pull/732/changes/2c8c152988cb68a3d622d90bddbd3af962e27901



##########
arrow/flight/flightsql/client.go:
##########
@@ -1105,13 +1107,14 @@ func (tx *Txn) RollbackSavepoint(ctx context.Context, 
sp Savepoint, opts ...grpc
 // prepared statement handle.
 //
 // If the server returned the Dataset Schema or Parameter Binding schemas
-// at creation, they will also be accessible from this object. Close
+// or isUpdate at creation, they will also be accessible from this object. 
Close
 // should be called when no longer needed.

Review Comment:
   Addressed in 
https://github.com/apache/arrow-go/pull/732/changes/028867928ff59e7f4a86eda023b8576f63b0c8c6



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