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


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs:
##########
@@ -406,7 +407,36 @@ private async Task<QueryResult> 
GetColumnsAsync(CancellationToken cancellationTo
                 cancellationToken);
             OperationHandle = resp.OperationHandle;
 
-            return await GetQueryResult(resp.DirectResults, cancellationToken);
+            // For GetColumns, we need to enhance the result with 
BASE_TYPE_NAME
+            if (Connection.AreResultsAvailableDirectly() && 
resp.DirectResults?.ResultSet?.Results != null)
+            {
+                TGetResultSetMetadataResp resultSetMetadata = 
resp.DirectResults.ResultSetMetadata;
+                Schema schema = 
Connection.SchemaParser.GetArrowSchema(resultSetMetadata.Schema, 
Connection.DataTypeConversion);
+                TRowSet rowSet = resp.DirectResults.ResultSet.Results;
+                int columnCount = HiveServer2Reader.GetColumnCount(rowSet);
+                int rowCount = HiveServer2Reader.GetRowCount(rowSet, 
columnCount);
+                IReadOnlyList<IArrowArray> data = 
HiveServer2Reader.GetArrowArrayData(rowSet, columnCount, schema, 
Connection.DataTypeConversion);
+
+                return EnhanceGetColumnsResult(schema, data, rowCount, 
resultSetMetadata, rowSet);
+            }
+            else
+            {
+                await 
HiveServer2Connection.PollForResponseAsync(OperationHandle!, Connection.Client, 
PollTimeMilliseconds, cancellationToken);
+                Schema schema = await 
GetResultSetSchemaAsync(OperationHandle!, Connection.Client, cancellationToken);
+
+                // Fetch the results manually to enhance them
+                TRowSet rowSet = await 
Connection.FetchResultsAsync(OperationHandle!, BatchSize, cancellationToken);
+                int columnCount = HiveServer2Reader.GetColumnCount(rowSet);
+                int rowCount = HiveServer2Reader.GetRowCount(rowSet, 
columnCount);
+
+                // Get metadata again to ensure we have the latest
+                TGetResultSetMetadataResp metadata = await 
HiveServer2Connection.GetResultSetMetadataAsync(OperationHandle!, 
Connection.Client, cancellationToken);

Review Comment:
   This looks like a duplicate call with the call to `GetResultSetSchemaAsync`. 
Is there any way to avoid the extra call?



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