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


##########
csharp/src/Drivers/Apache/Thrift/Service/Rpc/Thrift/TDoubleColumn.cs:
##########
@@ -78,14 +79,19 @@ public TDoubleColumn DeepCopy()
                   var _list178 = await 
iprot.ReadListBeginAsync(cancellationToken);
                   length = _list178.Count;
 
-                  buffer = new byte[length * 8];
+                  buffer = new byte[length * DoubleSize];
                   var memory = buffer.AsMemory();
                   var typedMemory = Unsafe.As<Memory<byte>, Memory<long>>(ref 
memory).Slice(0, length);
                   iprot.Transport.CheckReadBytesAvailable(buffer.Length);
                   await transport.ReadExactlyAsync(memory, cancellationToken);
                   for (int _i179 = 0; _i179 < length; ++_i179)
                   {
+#if NET6_0_OR_GREATER
                     typedMemory.Span[_i179] = 
BinaryPrimitives.ReverseEndianness(typedMemory.Span[_i179]);
+#else
+                    long source = 
BinaryPrimitives.ReverseEndianness(BitConverter.ToInt64(buffer, _i179 * 
DoubleSize));
+                    BitConverter.GetBytes(source).CopyTo(buffer, _i179 * 
DoubleSize);

Review Comment:
   @CurtHagenlocher 
   Just an explanation, it seems the behavior of the Unsafe implementation is 
different before NET 6 - hence the conditional compilation. I'll attempt a more 
efficient implementation.



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