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


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Statement.cs:
##########
@@ -587,5 +590,137 @@ protected internal QueryResult 
EnhanceGetColumnsResult(Schema originalSchema, IR
 
             return new QueryResult(rowCount, new 
HiveServer2Connection.HiveInfoArrowStream(enhancedSchema, enhancedData));
         }
+
+        private async Task<QueryResult> 
GetColumnsExtendedAsync(CancellationToken cancellationToken = default)
+        {
+            // 1. Get all three results at once
+            var columnsResult = await GetColumnsAsync(cancellationToken);
+            if (columnsResult.Stream == null) return columnsResult;
+
+            var pkResult = await GetPrimaryKeysAsync(cancellationToken);
+
+            // For FK lookup, we need to pass in the current 
catalog/schema/table as the foreign table
+            var resp = await Connection.GetCrossReferenceAsync(
+                null,
+                null,
+                null,
+                CatalogName,
+                SchemaName,
+                TableName,
+                cancellationToken);
+
+            var fkResult = await GetQueryResult(resp.DirectResults, 
cancellationToken);
+
+
+            // 2. Read all batches into memory
+            RecordBatch? columnsBatch = null;
+            RecordBatch? pkBatch = null;
+            RecordBatch? fkBatch = null;
+
+            // Extract column data
+            using (var stream = columnsResult.Stream)
+            {
+                columnsBatch = await 
stream.ReadNextRecordBatchAsync(cancellationToken);

Review Comment:
   Nope this is not guaranteed, for metadata queries this should be true since 
result size should be small, but is not guarateed. I'll change it.



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