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


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs:
##########
@@ -142,7 +146,8 @@ private async Task<QueryResult> 
ExecuteQueryAsyncInternal(CancellationToken canc
                     metadata = await 
HiveServer2Connection.GetResultSetMetadataAsync(OperationHandle!, 
Connection.Client, cancellationToken);
                 }
                 Schema schema = GetSchemaFromMetadata(metadata);
-                return new QueryResult(-1, Connection.NewReader(this, schema, 
metadata));
+                _currentQueryResult = new QueryResult(-1, 
Connection.NewReader(this, schema, metadata));

Review Comment:
   I would argue that it is the consumer of the `QueryResult` that is 
responsible to dispose the stream. The lifetime of the `Stream` should be 
independent of the lifetime of the `Statement`.
   
   
[Example](https://github.com/birschick-bq/arrow-adbc/blob/bc70e7e3c87763a0df32afcfdd32f4ccd977f265/csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs?plain=1#L402C1-L402C123).
   
   Why independent? If a consumer wants to gradually consume the results, they 
may hold onto the QueryResult longer than the Statement.



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to