Skip to content

Commit dc3ca18

Browse files
alokdeoraniCopilotCurtHagenlocher
authored
feat(csharp): BigQueryPerformance changes (#88)
This change focuses on performance and metadata handling. Key changes include: Metadata Query Support: The driver now supports standard ADBC metadata retrieval functions. This allows you to query for catalogs (projects), schemas (datasets), tables, columns, and primary keys. This is much faster than querying InformationSchema. Automatic Large Query Handling: The driver now performs a "dry run" before executing a query. If it estimates that the query will process a large amount of data (over 120MB), it automatically enables settings to handle large results, improving performance and reliability for big queries. New Configuration Parameters: Several new parameters have been added to control these new features, such as adbc.bigquery.include_public_project_id and parameters for metadata commands. Testing Updates: The testing framework has been updated to validate the new metadata functionality. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Curt Hagenlocher <curt@hagenlocher.org>
1 parent a28e8a0 commit dc3ca18

File tree

7 files changed

+525
-31
lines changed

7 files changed

+525
-31
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "csharp/arrow-adbc"]
2-
path = csharp/arrow-adbc
3-
url = git@github.com:apache/arrow-adbc.git
2+
path = csharp/arrow-adbc
3+
url = https://github.com/apache/arrow-adbc.git

csharp/src/BigQueryConnection.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class BigQueryConnection : TracingConnection, ITokenProtectedResource
5353
{
5454
readonly Dictionary<string, string> properties;
5555
readonly HttpClient httpClient;
56-
bool includePublicProjectIds = false;
5756
const string infoDriverName = "ADBC BigQuery Driver";
5857
const string infoVendorName = "BigQuery";
5958
// Note: this needs to be set before the constructor runs
@@ -161,6 +160,8 @@ private bool TryInitTracerProvider(out FileActivityListener? fileActivityListene
161160
// if this value is null, the BigQuery API chooses the location (typically the `US` multi-region)
162161
internal string? DefaultClientLocation { get; private set; }
163162

163+
internal bool IncludePublicProjectIds { get; private set; } = false;
164+
164165
public override string AssemblyVersion => BigQueryUtils.BigQueryAssemblyVersion;
165166

166167
public override string AssemblyName => BigQueryUtils.BigQueryAssemblyName;
@@ -211,8 +212,8 @@ internal BigQueryClient Open(string? projectId = null)
211212
{
212213
if (!string.IsNullOrEmpty(result))
213214
{
214-
this.includePublicProjectIds = Convert.ToBoolean(result);
215-
activity?.AddBigQueryParameterTag(BigQueryParameters.IncludePublicProjectId, this.includePublicProjectIds);
215+
this.IncludePublicProjectIds = Convert.ToBoolean(result);
216+
activity?.AddBigQueryParameterTag(BigQueryParameters.IncludePublicProjectId, this.IncludePublicProjectIds);
216217
}
217218
}
218219

@@ -613,7 +614,7 @@ private IArrowArray[] GetCatalogs(
613614
projectIds = catalogs.Select(x => x.ProjectId).ToList();
614615
}
615616

616-
if (this.includePublicProjectIds && !projectIds.Contains(BigQueryConstants.PublicProjectId))
617+
if (this.IncludePublicProjectIds && !projectIds.Contains(BigQueryConstants.PublicProjectId))
617618
projectIds.Add(BigQueryConstants.PublicProjectId);
618619

619620
projectIds.Sort();

csharp/src/BigQueryParameters.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ internal class BigQueryParameters
4343
public const string GetQueryResultsOptionsTimeout = "adbc.bigquery.get_query_results_options.timeout";
4444
public const string IncludeConstraintsWithGetObjects = "adbc.bigquery.include_constraints_getobjects";
4545
public const string IncludePublicProjectId = "adbc.bigquery.include_public_project_id";
46+
public const string CatalogName = "adbc.get_metadata.target_catalog";
47+
public const string SchemaName = "adbc.get_metadata.target_db_schema";
48+
public const string TableName = "adbc.get_metadata.target_table";
4649
public const string JsonCredential = "adbc.bigquery.auth_json_credential";
4750
public const string LargeDecimalsAsString = "adbc.bigquery.large_decimals_as_string";
4851
public const string LargeResultsDataset = "adbc.bigquery.large_results_dataset";
@@ -57,6 +60,7 @@ internal class BigQueryParameters
5760
public const string StatementIndex = "adbc.bigquery.multiple_statement.statement_index";
5861
public const string StatementType = "adbc.bigquery.multiple_statement.statement_type";
5962
public const string UseLegacySQL = "adbc.bigquery.use_legacy_sql";
63+
public const string IsMetadataCommand = "adbc.bigquery.statement.is_metadata_command";
6064

6165
/// <summary>
6266
/// Indicates whether the driver should create the dataset specified in the

0 commit comments

Comments
 (0)