Eric Erhardt created ARROW-5278:
-----------------------------------

             Summary: [C#] ArrowBuffer should either implement IEquatable 
correctly or not at all
                 Key: ARROW-5278
                 URL: https://issues.apache.org/jira/browse/ARROW-5278
             Project: Apache Arrow
          Issue Type: Bug
            Reporter: Eric Erhardt


See the discussion 
[here|https://github.com/apache/arrow/pull/3925/#discussion_r281378027].

ArrowBuffer currently implement IEquatable, but doesn't override `GetHashCode`.

We should either implement IEquatable correctly by overriding Equals and 
GetHashCode, or remove IEquatable all together.

Looking at ArrowBuffer's [Equals 
implementation|https://github.com/apache/arrow/blob/08829248fd540b7e3bd96b980e357f8a4db7970e/csharp/src/Apache.Arrow/ArrowBuffer.cs#L66-L69],
 it compares each value in the buffer, which is not very efficient. Also, this 
implementation is not consistent with how `Memory<T>` implements IEquatable - 
[https://source.dot.net/#System.Private.CoreLib/shared/System/Memory.cs,500].

If we continue implementing IEquatable on ArrowBuffer, we should consider 
implementing it in the same fashion as Memory<T> does.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to