spanner: do not copy protobuf messages by value.
@@ -261,18 +261,30 @@ func (t *BatchReadOnlyTransaction) Execute(ctx context.Context, p *Partition) *R
}
// Read or query partition.
if p.rreq != nil {
- req := *p.rreq
- req.PartitionToken = p.pt
rpc = func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) {
- req.ResumeToken = resumeToken
- return client.StreamingRead(ctx, &req)
+ return client.StreamingRead(ctx, &sppb.ReadRequest{
+ Session: p.rreq.Session,
+ Transaction: p.rreq.Transaction,
+ Table: p.rreq.Table,
+ Index: p.rreq.Index,
+ Columns: p.rreq.Columns,
+ KeySet: p.rreq.KeySet,
+ PartitionToken: p.pt,
+ ResumeToken: resumeToken,
+ })
}
} else {
- req := *p.qreq
- req.PartitionToken = p.pt
rpc = func(ctx context.Context, resumeToken []byte) (streamingReceiver, error) {
- req.ResumeToken = resumeToken
- return client.ExecuteStreamingSql(ctx, &req)
+ return client.ExecuteStreamingSql(ctx, &sppb.ExecuteSqlRequest{
+ Session: p.qreq.Session,
+ Transaction: p.qreq.Transaction,
+ Sql: p.qreq.Sql,
+ Params: p.qreq.Params,
+ ParamTypes: p.qreq.ParamTypes,
+ QueryOptions: p.qreq.QueryOptions,
+ PartitionToken: p.pt,
+ ResumeToken: resumeToken,
+ })
}
}
return stream(
