zeroshade commented on code in PR #33795:
URL: https://github.com/apache/arrow/pull/33795#discussion_r1082761204
##########
go/arrow/flight/flightsql/client.go:
##########
@@ -518,22 +544,44 @@ func (p *PreparedStatement) GetSchema(ctx
context.Context) (*flight.SchemaResult
return p.client.getSchema(ctx, desc, p.opts...)
}
-// SetParameters takes a record batch to send as the parameter bindings when
-// executing. It should match the schema from ParameterSchema.
-//
-// This will call Retain on the record to ensure it doesn't get released
-// out from under the statement. Release will be called on a previous
-// binding record if it existed, and will be called upon calling Close
-// on the PreparedStatement.
-func (p *PreparedStatement) SetParameters(binding arrow.Record) {
+func (p *PreparedStatement) clearParameters() {
if p.paramBinding != nil {
p.paramBinding.Release()
p.paramBinding = nil
}
+ if p.streamBinding != nil {
+ p.streamBinding.Release()
+ p.streamBinding = nil
+ }
+}
+
+// SetParameters takes a record batch to send as the parameter bindings when
+// executing. It should match the schema from ParameterSchema.
+//
+// This will call Retain on the record to ensure it doesn't get released out
+// from under the statement. Release will be called on a previous binding
+// record or reader if it existed, and will be called upon calling Close on the
+// PreparedStatement.
+func (p *PreparedStatement) SetParameters(binding arrow.Record) {
+ p.clearParameters()
p.paramBinding = binding
p.paramBinding.Retain()
}
Review Comment:
nvm just saw you have `Release will be called on a previous binding record
or reader`, ignore this :)
--
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]