Skip to content

Commit

Permalink
feat(bigquery): set PreferredMinStreamCount when creating read session (
Browse files Browse the repository at this point in the history
#8476)

`PreferredMinStreamCount` must be less than or equal to `MaxStreamCount`, so we only set it when the `MaxStreamCount` is 0, which basically sets no limit to it.

Resolves #8432
  • Loading branch information
alvarowolfx authored Aug 30, 2023
1 parent fbfaf21 commit 22e095a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bigquery/storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,19 @@ type readSession struct {

// Start initiates a read session
func (rs *readSession) start() error {
var preferredMinStreamCount int32
maxStreamCount := int32(rs.settings.maxStreamCount)
if maxStreamCount == 0 {
preferredMinStreamCount = int32(rs.settings.maxWorkerCount)
}
createReadSessionRequest := &storagepb.CreateReadSessionRequest{
Parent: fmt.Sprintf("projects/%s", rs.table.ProjectID),
ReadSession: &storagepb.ReadSession{
Table: rs.tableID,
DataFormat: storagepb.DataFormat_ARROW,
},
MaxStreamCount: int32(rs.settings.maxStreamCount),
MaxStreamCount: maxStreamCount,
PreferredMinStreamCount: preferredMinStreamCount,
}
rpcOpts := gax.WithGRPCOptions(
// Read API can send batches up to 128MB
Expand Down

0 comments on commit 22e095a

Please sign in to comment.