You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "CurtHagenlocher (via GitHub)" <gi...@apache.org> on 2024/09/19 16:56:10 UTC

Re: [PR] fix(csharp/src/Drivers/BigQuery): Fixed GBQ driver issue when results.TableReference is null [arrow-adbc]

CurtHagenlocher commented on code in PR #2165:
URL: https://github.com/apache/arrow-adbc/pull/2165#discussion_r1767208226


##########
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##########
@@ -75,6 +76,24 @@ public override QueryResult ExecuteQuery()
             readClientBuilder.Credential = this.credential;
             BigQueryReadClient readClient = readClientBuilder.Build();
 
+            if (results.TableReference == null)
+            {
+                ListJobsOptions listJobsOptions = new ListJobsOptions();
+                listJobsOptions.ParentJobId = results.JobReference.JobId;
+                PagedEnumerable<JobList, BigQueryJob> joblist = client.ListJobs(listJobsOptions);
+                BigQueryJob firstQueryJob = new BigQueryJob(client, job.Resource);
+                foreach (BigQueryJob childJob in joblist)
+                {
+                    var tempJob = client.GetJob(childJob.Reference.JobId);
+                    var query = tempJob.Resource?.Configuration?.Query;
+                    if (query != null && query.DestinationTable != null && query.DestinationTable.ProjectId != null && query.DestinationTable.DatasetId != null && query.DestinationTable.TableId != null)

Review Comment:
   What would it mean if there were multiple child jobs that match these criteria? Should that produce an error?



##########
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##########
@@ -75,6 +76,24 @@ public override QueryResult ExecuteQuery()
             readClientBuilder.Credential = this.credential;
             BigQueryReadClient readClient = readClientBuilder.Build();
 
+            if (results.TableReference == null)
+            {
+                ListJobsOptions listJobsOptions = new ListJobsOptions();

Review Comment:
   This doesn't look like obvious logic. If there's specific documentation for BigQuery which describes this behavior then it would be good to link to that from the source code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org