CurtHagenlocher commented on code in PR #2296:
URL: https://github.com/apache/arrow-adbc/pull/2296#discussion_r1825879537


##########
csharp/src/Drivers/Apache/Hive2/HiveServer2Reader.cs:
##########
@@ -178,6 +189,18 @@ internal static Date32Array ConvertToDate32(StringArray 
array, IArrowType _)
             return resultArray.Build();
         }
 
+        internal static FloatArray ConvertToFloat(DoubleArray array, 
IArrowType _)
+        {
+            var resultArray = new FloatArray.Builder();
+            int length = array.Length;

Review Comment:
   Generally -- and this applies to `ConvertToDate32` as well -- it's much 
better to first call `resultArray.Reserve(length)` before starting to append 
values. This avoids the need to resize the buffers as the array grows. An array 
of length 100 would need to be resized four times (8 -> 16, 16 -> 32, 32 -> 64 
and 64 -> 128), and each resizing involves allocating a new buffer and copying 
the values over from the old buffer.



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