Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-18 Thread via GitHub


CurtHagenlocher merged PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-18 Thread via GitHub


qifanzhang-ms commented on code in PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#discussion_r2050378342


##
csharp/test/Drivers/BigQuery/DriverTests.cs:
##
@@ -346,5 +346,43 @@ public void QueryTimeoutTest()
 }
 }
 }
+
+/// 
+/// Validates if the driver can connect to a live server and
+/// parse the results of multi-statements.
+/// 
+[SkippableFact, Order(9)]
+public void CanExecuteMultiStatementQuery()
+{
+foreach (BigQueryTestEnvironment environment in _environments)
+{
+AdbcConnection adbcConnection = 
GetAdbcConnection(environment.Name);
+AdbcStatement statement = adbcConnection.CreateStatement();
+string query1 = "SELECT " +
+"CAST(1 as INT64) as id, " +
+"CAST(1.23 as FLOAT64) as number, " +
+"PARSE_NUMERIC(\"4.56\") as decimal, " +
+
"PARSE_BIGNUMERIC(\"7.89\") as big_decimal, 
" +
+"CAST(True as BOOL) as is_active, " +
+"'John Doe' as name, " +
+"FROM_BASE64('YWJjMTIz') as data, " +
+"CAST('2023-09-08' as DATE) as date, " +
+"CAST('12:34:56' as TIME) as time, " +
+"CAST('2023-09-08 12:34:56' as DATETIME) as datetime, 
" +
+"CAST('2023-09-08 12:34:56+00:00' as TIMESTAMP) as 
timestamp, " +
+"ST_GEOGPOINT(1, 2) as point, " +
+"ARRAY[1, 2, 3] as numbers, " +
+"STRUCT('John Doe' as name, 30 as age) as person," +
+"PARSE_JSON('{\"name\":\"Jane Doe\",\"age\":29}') as 
json";
+string query2 = "SELECT " +
+  "CAST(1.7976931348623157e+308 as FLOAT64) as number, 
" +
+  
"PARSE_NUMERIC(\"9.E+28\") as decimal, " +
+  
"PARSE_BIGNUMERIC(\"5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+37\")
 as big_decimal";
+string combinedQuery = query1 + ";" + query2 + ";";
+statement.SqlQuery = combinedQuery;
+QueryResult queryResult = statement.ExecuteQuery();
+Tests.DriverTests.CanExecuteQuery(queryResult, 1, 
environment.Name);

Review Comment:
   The public data has been used to make the query have different number of rows



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-18 Thread via GitHub


qifanzhang-ms commented on code in PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#discussion_r2050342068


##
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##
@@ -51,52 +51,60 @@ public BigQueryStatement(BigQueryClient client, 
GoogleCredential credential)
 
 public override QueryResult ExecuteQuery()
 {
+// Create job
 QueryOptions queryOptions = ValidateOptions();
-
 BigQueryJob job = this.client.CreateQueryJob(SqlQuery, null, 
queryOptions);
 
+// Get results
 GetQueryResultsOptions getQueryResultsOptions = new 
GetQueryResultsOptions();
-
 if 
(this.Options?.TryGetValue(BigQueryParameters.GetQueryResultsOptionsTimeout, 
out string? timeoutSeconds) == true &&
 int.TryParse(timeoutSeconds, out int seconds) &&
 seconds >= 0)
 {
 getQueryResultsOptions.Timeout = TimeSpan.FromSeconds(seconds);
 }
-
 BigQueryResults results = 
job.GetQueryResults(getQueryResultsOptions);
 
-BigQueryReadClientBuilder readClientBuilder = new 
BigQueryReadClientBuilder();
-readClientBuilder.Credential = this.credential;
-BigQueryReadClient readClient = readClientBuilder.Build();
-
+// For multi-statement queries, the results.TableReference is null
 if (results.TableReference == null)
 {
-// To get the results of all statements in a multi-statement 
query, enumerate the child jobs and call jobs.getQueryResults on each of them.
-// Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements
+string statementType = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.StatementType, out string? 
statementTypeString) == true)
+{
+statementType = statementTypeString;
+}
+string evaluationKind = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.EvaluationKind, out string? 
evaluationKindString) == true)
+{
+evaluationKind = evaluationKindString;
+}
+
+// To get the results of all statements in a multi-statement 
query, enumerate the child jobs. Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements.
+// Can filter by StatementType and EvaluationKind. Related 
public docs: 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobstatistics2, 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#evaluationkind
 ListJobsOptions listJobsOptions = new ListJobsOptions();
 listJobsOptions.ParentJobId = results.JobReference.JobId;
-PagedEnumerable joblist = 
client.ListJobs(listJobsOptions);
-BigQueryJob firstQueryJob = new BigQueryJob(client, 
job.Resource);
-foreach (BigQueryJob childJob in joblist)
+var joblist = client.ListJobs(listJobsOptions)
+.Select(job => client.GetJob(job.Reference))
+.Where(job => string.IsNullOrEmpty(evaluationKind) || 
job.Statistics.ScriptStatistics.EvaluationKind.Equals(evaluationKind, 
StringComparison.OrdinalIgnoreCase))
+.Where(job => string.IsNullOrEmpty(statementType) || 
job.Statistics.Query.StatementType.Equals(statementType,StringComparison.OrdinalIgnoreCase))
+.OrderBy(job => job.Resource.Statistics.CreationTime)

Review Comment:
   The order of jobs on the gbq service portal is based on creationTime.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-18 Thread via GitHub


qifanzhang-ms commented on code in PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#discussion_r2050328562


##
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##
@@ -51,52 +51,60 @@ public BigQueryStatement(BigQueryClient client, 
GoogleCredential credential)
 
 public override QueryResult ExecuteQuery()
 {
+// Create job
 QueryOptions queryOptions = ValidateOptions();
-
 BigQueryJob job = this.client.CreateQueryJob(SqlQuery, null, 
queryOptions);
 
+// Get results
 GetQueryResultsOptions getQueryResultsOptions = new 
GetQueryResultsOptions();
-
 if 
(this.Options?.TryGetValue(BigQueryParameters.GetQueryResultsOptionsTimeout, 
out string? timeoutSeconds) == true &&
 int.TryParse(timeoutSeconds, out int seconds) &&
 seconds >= 0)
 {
 getQueryResultsOptions.Timeout = TimeSpan.FromSeconds(seconds);
 }
-
 BigQueryResults results = 
job.GetQueryResults(getQueryResultsOptions);
 
-BigQueryReadClientBuilder readClientBuilder = new 
BigQueryReadClientBuilder();
-readClientBuilder.Credential = this.credential;
-BigQueryReadClient readClient = readClientBuilder.Build();
-
+// For multi-statement queries, the results.TableReference is null
 if (results.TableReference == null)
 {
-// To get the results of all statements in a multi-statement 
query, enumerate the child jobs and call jobs.getQueryResults on each of them.
-// Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements
+string statementType = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.StatementType, out string? 
statementTypeString) == true)
+{
+statementType = statementTypeString;
+}
+string evaluationKind = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.EvaluationKind, out string? 
evaluationKindString) == true)
+{
+evaluationKind = evaluationKindString;
+}
+
+// To get the results of all statements in a multi-statement 
query, enumerate the child jobs. Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements.
+// Can filter by StatementType and EvaluationKind. Related 
public docs: 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobstatistics2, 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#evaluationkind
 ListJobsOptions listJobsOptions = new ListJobsOptions();
 listJobsOptions.ParentJobId = results.JobReference.JobId;
-PagedEnumerable joblist = 
client.ListJobs(listJobsOptions);
-BigQueryJob firstQueryJob = new BigQueryJob(client, 
job.Resource);
-foreach (BigQueryJob childJob in joblist)
+var joblist = client.ListJobs(listJobsOptions)
+.Select(job => client.GetJob(job.Reference))
+.Where(job => string.IsNullOrEmpty(evaluationKind) || 
job.Statistics.ScriptStatistics.EvaluationKind.Equals(evaluationKind, 
StringComparison.OrdinalIgnoreCase))
+.Where(job => string.IsNullOrEmpty(statementType) || 
job.Statistics.Query.StatementType.Equals(statementType,StringComparison.OrdinalIgnoreCase))
+.OrderBy(job => job.Resource.Statistics.CreationTime)
+.ToList();

Review Comment:
   Add new feature: statementIndex



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-17 Thread via GitHub


qifanzhang-ms commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2814654287

   > I feel like I don't entirely understand this change, so it would be nice 
to get a little more explanation.
   > 
   > Today, there's a limitation in ADBC which prevents a single execution 
batch from returning multiple results. Now obviously, multiple statements 
doesn't have to mean multiple results because a statement could be e.g. DDL or 
BEGIN TRAN or some other thing which impacts session state. But accepting 
multiple statements implies that they _could_ each be returning results, and 
that's where things feel a little sketchy. It looks like the two added 
parameters are intended to filter down the set of results in order to pick just 
one. But they do so in a way that doesn't (to me) obviously ensure that only 
one result will match the criteria. What if there are two results with the same 
statement type and evaluation kind? Picking the first one feels a little 
arbitrary.
   > 
   > What I'd naively expect if I passed multiple statements and needed to 
indicate which one's results I wanted would be to supply the index of the 
statement. So for "statement1; statement2; statement3", if I wanted the results 
from statement2 I might pass either 1 or 2 depending on how I feel about 
zero-indexing vs one-indexing.
   > 
   > Is the current design something that users of the e.g. BigQuery ODBC 
driver would already be familiar with? Do certain statement types and 
evaluation kinds never come with real result data and can therefore be omitted 
by default if e.g. an index wasn't specified?
   
   Your understanding is very accurate. The behavior of picking the first one 
statement is designed because the Connector implemented by the previous 
BigQuery ODBC driver has such behavior, which is also the behavior that 
customers want.
   
   Supplying the index of the statement is indeed a reasonable feature, but 
there is no specific customer demand at present.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-16 Thread via GitHub


davidhcoe commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2810130958

   > (Also, it would be nice if we tried to maintain some alignment between the 
C# BigQuery driver and the Go BigQuery driver -- though it may already be a 
little late for that :(. CC: @lidavidm for possible additional feedback.)
   
   We started the C# one before the Go one was available and I haven’t followed 
the Go one too closely.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-16 Thread via GitHub


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


##
csharp/test/Drivers/BigQuery/DriverTests.cs:
##
@@ -346,5 +346,43 @@ public void QueryTimeoutTest()
 }
 }
 }
+
+/// 
+/// Validates if the driver can connect to a live server and
+/// parse the results of multi-statements.
+/// 
+[SkippableFact, Order(9)]
+public void CanExecuteMultiStatementQuery()
+{
+foreach (BigQueryTestEnvironment environment in _environments)
+{
+AdbcConnection adbcConnection = 
GetAdbcConnection(environment.Name);
+AdbcStatement statement = adbcConnection.CreateStatement();
+string query1 = "SELECT " +
+"CAST(1 as INT64) as id, " +
+"CAST(1.23 as FLOAT64) as number, " +
+"PARSE_NUMERIC(\"4.56\") as decimal, " +
+
"PARSE_BIGNUMERIC(\"7.89\") as big_decimal, 
" +
+"CAST(True as BOOL) as is_active, " +
+"'John Doe' as name, " +
+"FROM_BASE64('YWJjMTIz') as data, " +
+"CAST('2023-09-08' as DATE) as date, " +
+"CAST('12:34:56' as TIME) as time, " +
+"CAST('2023-09-08 12:34:56' as DATETIME) as datetime, 
" +
+"CAST('2023-09-08 12:34:56+00:00' as TIMESTAMP) as 
timestamp, " +
+"ST_GEOGPOINT(1, 2) as point, " +
+"ARRAY[1, 2, 3] as numbers, " +
+"STRUCT('John Doe' as name, 30 as age) as person," +
+"PARSE_JSON('{\"name\":\"Jane Doe\",\"age\":29}') as 
json";
+string query2 = "SELECT " +
+  "CAST(1.7976931348623157e+308 as FLOAT64) as number, 
" +
+  
"PARSE_NUMERIC(\"9.E+28\") as decimal, " +
+  
"PARSE_BIGNUMERIC(\"5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+37\")
 as big_decimal";
+string combinedQuery = query1 + ";" + query2 + ";";
+statement.SqlQuery = combinedQuery;
+QueryResult queryResult = statement.ExecuteQuery();
+Tests.DriverTests.CanExecuteQuery(queryResult, 1, 
environment.Name);

Review Comment:
   I would expect this test to validate which of the two results is being 
returned as this seems a critical part of the driver contract.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-16 Thread via GitHub


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


##
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##
@@ -51,52 +51,60 @@ public BigQueryStatement(BigQueryClient client, 
GoogleCredential credential)
 
 public override QueryResult ExecuteQuery()
 {
+// Create job
 QueryOptions queryOptions = ValidateOptions();
-
 BigQueryJob job = this.client.CreateQueryJob(SqlQuery, null, 
queryOptions);
 
+// Get results
 GetQueryResultsOptions getQueryResultsOptions = new 
GetQueryResultsOptions();
-
 if 
(this.Options?.TryGetValue(BigQueryParameters.GetQueryResultsOptionsTimeout, 
out string? timeoutSeconds) == true &&
 int.TryParse(timeoutSeconds, out int seconds) &&
 seconds >= 0)
 {
 getQueryResultsOptions.Timeout = TimeSpan.FromSeconds(seconds);
 }
-
 BigQueryResults results = 
job.GetQueryResults(getQueryResultsOptions);
 
-BigQueryReadClientBuilder readClientBuilder = new 
BigQueryReadClientBuilder();
-readClientBuilder.Credential = this.credential;
-BigQueryReadClient readClient = readClientBuilder.Build();
-
+// For multi-statement queries, the results.TableReference is null
 if (results.TableReference == null)
 {
-// To get the results of all statements in a multi-statement 
query, enumerate the child jobs and call jobs.getQueryResults on each of them.
-// Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements
+string statementType = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.StatementType, out string? 
statementTypeString) == true)
+{
+statementType = statementTypeString;
+}
+string evaluationKind = string.Empty;
+if 
(this.Options?.TryGetValue(BigQueryParameters.EvaluationKind, out string? 
evaluationKindString) == true)
+{
+evaluationKind = evaluationKindString;
+}
+
+// To get the results of all statements in a multi-statement 
query, enumerate the child jobs. Related public docs: 
https://cloud.google.com/bigquery/docs/multi-statement-queries#get_all_executed_statements.
+// Can filter by StatementType and EvaluationKind. Related 
public docs: 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobstatistics2, 
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#evaluationkind
 ListJobsOptions listJobsOptions = new ListJobsOptions();
 listJobsOptions.ParentJobId = results.JobReference.JobId;
-PagedEnumerable joblist = 
client.ListJobs(listJobsOptions);
-BigQueryJob firstQueryJob = new BigQueryJob(client, 
job.Resource);
-foreach (BigQueryJob childJob in joblist)
+var joblist = client.ListJobs(listJobsOptions)
+.Select(job => client.GetJob(job.Reference))
+.Where(job => string.IsNullOrEmpty(evaluationKind) || 
job.Statistics.ScriptStatistics.EvaluationKind.Equals(evaluationKind, 
StringComparison.OrdinalIgnoreCase))
+.Where(job => string.IsNullOrEmpty(statementType) || 
job.Statistics.Query.StatementType.Equals(statementType,StringComparison.OrdinalIgnoreCase))
+.OrderBy(job => job.Resource.Statistics.CreationTime)
+.ToList();

Review Comment:
   ```suggestion
   .FirstOrDefault();
   ```
   
   No need to materialize a list if we only need one item.



##
csharp/src/Drivers/BigQuery/BigQueryStatement.cs:
##
@@ -51,52 +51,60 @@ public BigQueryStatement(BigQueryClient client, 
GoogleCredential credential)
 
 public override QueryResult ExecuteQuery()
 {
+// Create job
 QueryOptions queryOptions = ValidateOptions();
-
 BigQueryJob job = this.client.CreateQueryJob(SqlQuery, null, 
queryOptions);
 
+// Get results
 GetQueryResultsOptions getQueryResultsOptions = new 
GetQueryResultsOptions();
-
 if 
(this.Options?.TryGetValue(BigQueryParameters.GetQueryResultsOptionsTimeout, 
out string? timeoutSeconds) == true &&
 int.TryParse(timeoutSeconds, out int seconds) &&
 seconds >= 0)
 {
 getQueryResultsOptions.Timeout = TimeSpan.FromSeconds(seconds);
 }
-
 BigQueryResults results = 
job.GetQueryResults(getQueryResultsOptions);
 
-BigQueryReadClientBuilder readClientBuilder = new 
BigQueryReadClientBuilder();
-readClientBuilder.Credential 

Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-16 Thread via GitHub


CurtHagenlocher commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2809790484

   (Also, it would be nice if we tried to maintain some alignment between the 
C# BigQuery driver and the Go BigQuery driver -- though it may already be a 
little late for that :(. CC: @lidavidm for possible additional feedback.)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-16 Thread via GitHub


CurtHagenlocher commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2809785069

   I feel like I don't entirely understand this change, so it would be nice to 
get a little more explanation.
   
   Today, there's a limitation in ADBC which prevents a single execution batch 
from returning multiple results. Now obviously, multiple statements doesn't 
have to mean multiple results because a statement could be e.g. DDL or BEGIN 
TRAN or some other thing which impacts session state. But accepting multiple 
statements implies that they *could* each be returning results, and that's 
where things feel a little sketchy. It looks like the two added parameters are 
intended to filter down the set of results in order to pick just one. But they 
do so in a way that doesn't (to me) obviously ensure that only one result will 
match the criteria. What if there are two results with the same statement type 
and evaluation kind? Picking the first one feels a little arbitrary. 
   
   What I'd naively expect if I passed multiple statements and needed to 
indicate which one's results I wanted would be to supply the index of the 
statement. So for "statement1; statement2; statement3", if I wanted the results 
from statement2 I might pass either 1 or 2 depending on how I feel about 
zero-indexing vs one-indexing. 
   
   Is the current design something that users of the e.g. BigQuery ODBC driver 
would already be familiar with?
   Do certain statement types and evaluation kinds never come with real result 
data and can therefore be omitted by default if e.g. an index wasn't specified?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-15 Thread via GitHub


qifanzhang-ms commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2804351948

   > > > Is there a specific multi-statement test that should be added 
(presumably from both the DriverTests and the ClientTests)?
   > > > I tried to add a test. Since our current test framework requires 
developers to write query statements in json files themselves, the added test 
would be a bit abrupt.
   > 
   > The way I would do something like this is for any environment that can 
execute a query. For example, something like:
   > 
   > ```
   >  [SkippableFact, Order(6)]
   >  public void CanExecuteMultiStatementQuery()
   >  {
   >  foreach (BigQueryTestEnvironment environment in _environments)
   >  {
   >  AdbcConnection adbcConnection = 
GetAdbcConnection(environment.Name);
   >  AdbcStatement statement = adbcConnection.CreateStatement();
   >  
   >   string query1 = "SELECT " +
   >   "CAST(1 as INT64) as id, " +
   >   "CAST(1.23 as FLOAT64) as number, " +
   >   "PARSE_NUMERIC(\"4.56\") as decimal, " +
   >   
"PARSE_BIGNUMERIC(\"7.89\") as big_decimal, 
" +
   >   "CAST(True as BOOL) as is_active, " +
   >   "'John Doe' as name, " +
   >   "FROM_BASE64('YWJjMTIz') as data, " +
   >   "CAST('2023-09-08' as DATE) as date, " +
   >   "CAST('12:34:56' as TIME) as time, " +
   >   "CAST('2023-09-08 12:34:56' as DATETIME) as datetime, " +
   >   "CAST('2023-09-08 12:34:56+00:00' as TIMESTAMP) as 
timestamp, " +
   >   "ST_GEOGPOINT(1, 2) as point, " +
   >   "ARRAY[1, 2, 3] as numbers, " +
   >   "STRUCT('John Doe' as name, 30 as age) as person," +
   >   "PARSE_JSON('{\"name\":\"Jane Doe\",\"age\":29}') as 
json";
   > 
   >  string query2 = "SELECT " +
   >"CAST(1.7976931348623157e+308 as FLOAT64) as number, " +
   >
"PARSE_NUMERIC(\"9.E+28\") as decimal, " +
   >  
   >
"PARSE_BIGNUMERIC(\"5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+37\")
   > 
   >  string combinedQuery = query1 + ";" + query2 + ";"
   >  statement.SqlQuery = combinedQuery;
   > 
   >  QueryResult queryResult = statement.ExecuteQuery();
   > 
   >// TODO: Assert the expected results from the two queries
   >  }
   >  }
   > ```
   > 
   > This will work without any tables being created and you can validate the 
result(s) of the multi-statement evaluation.
   > 
   > An alternative way could be to use the BigQuery public datasets to 
retrieve data as well.
   
   Thanks, have added.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-14 Thread via GitHub


davidhcoe commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2801831418

   > > Is there a specific multi-statement test that should be added 
(presumably from both the DriverTests and the ClientTests)?
   > > I tried to add a test. Since our current test framework requires 
developers to write query statements in json files themselves, the added test 
would be a bit abrupt.
   
   The way I would do something like this is for any environment that can 
execute a query. For example, something like:
   
   ```
[SkippableFact, Order(6)]
public void CanExecuteQuery()
{
foreach (BigQueryTestEnvironment environment in _environments)
{
AdbcConnection adbcConnection = GetAdbcConnection(environment.Name);
AdbcStatement statement = adbcConnection.CreateStatement();

 string query1 = "SELECT " +
 "CAST(1 as INT64) as id, " +
 "CAST(1.23 as FLOAT64) as number, " +
 "PARSE_NUMERIC(\"4.56\") as decimal, " +
 
"PARSE_BIGNUMERIC(\"7.89\") as big_decimal, 
" +
 "CAST(True as BOOL) as is_active, " +
 "'John Doe' as name, " +
 "FROM_BASE64('YWJjMTIz') as data, " +
 "CAST('2023-09-08' as DATE) as date, " +
 "CAST('12:34:56' as TIME) as time, " +
 "CAST('2023-09-08 12:34:56' as DATETIME) as datetime, " +
 "CAST('2023-09-08 12:34:56+00:00' as TIMESTAMP) as 
timestamp, " +
 "ST_GEOGPOINT(1, 2) as point, " +
 "ARRAY[1, 2, 3] as numbers, " +
 "STRUCT('John Doe' as name, 30 as age) as person," +
 "PARSE_JSON('{\"name\":\"Jane Doe\",\"age\":29}') as json";
   
string query2 = "SELECT " +
  "CAST(1.7976931348623157e+308 as FLOAT64) as number, " +
  
"PARSE_NUMERIC(\"9.E+28\") as decimal, " +

  
"PARSE_BIGNUMERIC(\"5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+37\")
   
string combinedQuery = query1 + ";" + query2 + ";"
statement.SqlQuery = combinedQuery;
   
QueryResult queryResult = statement.ExecuteQuery();
   
  // TODO: Assert the expected results from the two queries
}
}
   
   ```
   
   This will work without any tables being created and you can validate the 
result(s) of the multi-statement evaluation.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-14 Thread via GitHub


qifanzhang-ms commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2800921585

   > Is there a specific multi-statement test that should be added (presumably 
from both the DriverTests and the ClientTests)?
   I tried to add a test. Since our current test framework requires developers 
to write query statements in json files themselves, the added test would be a 
bit abrupt.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-14 Thread via GitHub


qifanzhang-ms commented on code in PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#discussion_r2041691598


##
csharp/test/Drivers/BigQuery/BigQueryTestConfiguration.cs:
##
@@ -97,6 +97,12 @@ public BigQueryTestEnvironment()
 [JsonPropertyName("maxStreamCount")]
 public int? MaxStreamCount { get; set; }
 
+[JsonPropertyName("statementType")]
+public string StatementType { get; set; } = string.Empty;
+
+[JsonPropertyName("statementIndex")]

Review Comment:
   fixed



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-11 Thread via GitHub


davidhcoe commented on PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#issuecomment-2797389066

   Is there a specific multi-statement test that should be added (presumably 
from both the DriverTests and the ClientTests)? 


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] feat(csharp/src/Drivers/BigQuery): support evaluation kind and statement type setting [arrow-adbc]

2025-04-11 Thread via GitHub


davidhcoe commented on code in PR #2698:
URL: https://github.com/apache/arrow-adbc/pull/2698#discussion_r2039878456


##
csharp/test/Drivers/BigQuery/BigQueryTestConfiguration.cs:
##
@@ -97,6 +97,12 @@ public BigQueryTestEnvironment()
 [JsonPropertyName("maxStreamCount")]
 public int? MaxStreamCount { get; set; }
 
+[JsonPropertyName("statementType")]
+public string StatementType { get; set; } = string.Empty;
+
+[JsonPropertyName("statementIndex")]

Review Comment:
   What is a statementIndex? How does that differ from evaluationKind?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]