-
Notifications
You must be signed in to change notification settings - Fork 103
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(csharp/src/Drivers/BigQuery): support max stream count setting when creating read session #2289
feat(csharp/src/Drivers/BigQuery): support max stream count setting when creating read session #2289
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,8 +103,19 @@ public override QueryResult ExecuteQuery() | |
|
||
string table = $"projects/{results.TableReference.ProjectId}/datasets/{results.TableReference.DatasetId}/tables/{results.TableReference.TableId}"; | ||
|
||
int maxStreamCount = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value is set to 1, mainly due to two reasons: 1 The original driver setting is 1. The GBQ MSDI driver is now being used by a large number of CXs, and changing this setting may cause potential regression. 2 The doc does say: If unset or zero, the server will provide a value of streams so as to produce reasonable throughput. But I found in my test that this is not 100% accurate. At least in my test of reading the same table, it took 42.5 minutes when max_stream_count=1 and 46.4 minutes when max_stream_count=0. Although this may be due to other reasons such as the test table content or network fluctuations, it at least shows that potential regression on perf exists. |
||
if (this.Options?.TryGetValue(BigQueryParameters.CreateReadSessionMaxStreamCount, out string? maxStreamCountString) == true) | ||
{ | ||
if (int.TryParse(maxStreamCountString, out int count)) | ||
{ | ||
if (count >= 0) | ||
{ | ||
maxStreamCount = count; | ||
} | ||
} | ||
} | ||
ReadSession rs = new ReadSession { Table = table, DataFormat = DataFormat.Arrow }; | ||
ReadSession rrs = readClient.CreateReadSession("projects/" + results.TableReference.ProjectId, rs, 1); | ||
ReadSession rrs = readClient.CreateReadSession("projects/" + results.TableReference.ProjectId, rs, maxStreamCount); | ||
|
||
long totalRows = results.TotalRows == null ? -1L : (long)results.TotalRows.Value; | ||
IArrowArrayStream stream = new MultiArrowReader(TranslateSchema(results.Schema), rrs.Streams.Select(s => ReadChunk(readClient, s.Name))); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name this something a little more meaningful to the user like
adbc.bigquery.max_fetch_concurrency
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change the constant name to match the property name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for the correction.