eric-wang-1990 commented on code in PR #3301:
URL: https://github.com/apache/arrow-adbc/pull/3301#discussion_r2283516068


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs:
##########
@@ -429,13 +429,17 @@ protected override void Dispose(bool disposing)
         /// <param name="response">The response for the operation.</param>
         /// <returns>The server response for the CloseOperation call.</returns>
         /// <exception cref="HiveServer2Exception" />
-        internal static async Task<TCloseOperationResp> 
CloseOperationAsync(IHiveServer2Statement statement, IResponse response)
+        internal static async Task<TCloseOperationResp?> 
CloseOperationAsync(IHiveServer2Statement statement, IResponse response)
         {
-            CancellationToken cancellationToken = 
ApacheUtility.GetCancellationToken(statement.QueryTimeoutSeconds, 
ApacheUtility.TimeUnit.Seconds);
-            TCloseOperationReq request = new 
TCloseOperationReq(response.OperationHandle!);
-            TCloseOperationResp resp = await 
statement.Client.CloseOperation(request, cancellationToken);
-            HiveServer2Connection.HandleThriftResponse(resp.Status, activity: 
null);
-            return resp;
+            if (response.DirectResults?.CloseOperation?.Status?.StatusCode != 
TStatusCode.SUCCESS_STATUS)
+            {
+                CancellationToken cancellationToken = 
ApacheUtility.GetCancellationToken(statement.QueryTimeoutSeconds, 
ApacheUtility.TimeUnit.Seconds);
+                TCloseOperationReq request = new 
TCloseOperationReq(response.OperationHandle!);
+                TCloseOperationResp resp = await 
statement.Client.CloseOperation(request, cancellationToken);
+                HiveServer2Connection.HandleThriftResponse(resp.Status, 
activity: null);
+                return resp;
+            }
+            return null;

Review Comment:
   Would this cause NPE here? 
https://github.com/apache/arrow-adbc/blob/8dd3d0b90c2802ca3cc800cc6525493297484c3d/csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs#L413



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