birschick-bq commented on code in PR #2312:
URL: https://github.com/apache/arrow-adbc/pull/2312#discussion_r1851112914


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs:
##########
@@ -40,12 +41,26 @@ protected virtual void 
SetStatementProperties(TExecuteStatementReq statement)
 
         public override async ValueTask<QueryResult> ExecuteQueryAsync()
         {
-            await ExecuteStatementAsync();
-            await HiveServer2Connection.PollForResponseAsync(OperationHandle!, 
Connection.Client, PollTimeMilliseconds);
-            Schema schema = await GetResultSetSchemaAsync(OperationHandle!, 
Connection.Client);
+            try
+            {
+                CancellationToken timeoutToken = 
ApacheUtility.GetCancellationToken(QueryTimeoutSeconds, 
ApacheUtility.TimeUnit.Seconds);
+
+                // this could either:
+                // take QueryTimeoutSeconds * 3
+                // OR
+                // take QueryTimeoutSeconds (but this could be restricting)
+
+                await ExecuteStatementAsync(timeoutToken); // --> get 
QueryTimeout +
+                await 
HiveServer2Connection.PollForResponseAsync(OperationHandle!, Connection.Client, 
PollTimeMilliseconds, timeoutToken); // + poll, up to QueryTimeout
+                Schema schema = await 
GetResultSetSchemaAsync(OperationHandle!, Connection.Client, timeoutToken); // 
+ get the result, up to QueryTimeout
 
-            // TODO: Ensure this is set dynamically based on server 
capabilities
-            return new QueryResult(-1, Connection.NewReader(this, schema));
+                // TODO: Ensure this is set dynamically based on server 
capabilities

Review Comment:
   nit:
   I think we can remote this TODO as we are dynamically creating a reader 
using the `Connection.NewReader` which understands the correct reader to create.



##########
csharp/src/Drivers/Apache/Spark/SparkStatement.cs:
##########
@@ -45,7 +46,7 @@ protected override void 
SetStatementProperties(TExecuteStatementReq statement)
             // TODO: Ensure this is set dynamically depending on server 
capabilities.
             statement.EnforceResultPersistenceMode = false;
             statement.ResultPersistenceMode = 2;
-
+            statement.QueryTimeout = QueryTimeoutSeconds; //it doesn't seem 
like we need to set this in combination with a CancellationToken, but keep it 
for now

Review Comment:
   If this informs the server to abandon the query, that would be a better 
outcome than having the client close the connection abruptly.



-- 
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]

Reply via email to