Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bigquery): set PreferredMinStreamCount when creating read session #8476

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
preferredMinStreamCount := int32(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a bit odd, why not just var preferredMinStreamCount int32?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let me change here. I think I was playing with default values and ended up leaving like that.

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