You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/06/04 19:52:14 UTC

[GitHub] [ignite] ptupitsyn opened a new pull request #9154: IGNITE-14826 .NET: Support string keys in thin client with partition awareness

ptupitsyn opened a new pull request #9154:
URL: https://github.com/apache/ignite/pull/9154


   Add missing support for `string` in `BinaryHashCodeUtils`, which calculates primary node for cache operations.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ptupitsyn merged pull request #9154: IGNITE-14826 .NET: Support string and array keys in thin client with partition awareness

Posted by GitBox <gi...@apache.org>.
ptupitsyn merged pull request #9154:
URL: https://github.com/apache/ignite/pull/9154


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ptupitsyn commented on a change in pull request #9154: IGNITE-14826 .NET: Support string and array keys in thin client with partition awareness

Posted by GitBox <gi...@apache.org>.
ptupitsyn commented on a change in pull request #9154:
URL: https://github.com/apache/ignite/pull/9154#discussion_r646435540



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHashCodeUtils.cs
##########
@@ -45,11 +45,33 @@ public static unsafe int GetHashCode<T>(T val, Marshaller marsh, IDictionary<int
             if (type == typeof(long))
                 return GetLongHashCode(TypeCaster<long>.Cast(val));
 
+            if (type == typeof(string))
+                return BinaryUtils.GetStringHashCode((string) (object) val);
+
+            if (type == typeof(Guid))
+                return GetGuidHashCode(TypeCaster<Guid>.Cast(val));
+
+            if (type == typeof(uint))
+            {
+                var val0 = TypeCaster<uint>.Cast(val);
+                return *(int*) &val0;
+            }
+
+            if (type == typeof(ulong))
+            {
+                var val0 = TypeCaster<ulong>.Cast(val);
+                return GetLongHashCode(*(long*) &val0);
+            }
+

Review comment:
       They were supported - check the diff. I've reordered the checks, so that more likely use cases come early.
   
   For example, I can imaging that `long`, `Guid` and `string` are among the most popular key type choices, while `double` would be very weird.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] isapego commented on a change in pull request #9154: IGNITE-14826 .NET: Support string and array keys in thin client with partition awareness

Posted by GitBox <gi...@apache.org>.
isapego commented on a change in pull request #9154:
URL: https://github.com/apache/ignite/pull/9154#discussion_r646409652



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHashCodeUtils.cs
##########
@@ -45,11 +45,33 @@ public static unsafe int GetHashCode<T>(T val, Marshaller marsh, IDictionary<int
             if (type == typeof(long))
                 return GetLongHashCode(TypeCaster<long>.Cast(val));
 
+            if (type == typeof(string))
+                return BinaryUtils.GetStringHashCode((string) (object) val);
+
+            if (type == typeof(Guid))
+                return GetGuidHashCode(TypeCaster<Guid>.Cast(val));
+
+            if (type == typeof(uint))
+            {
+                var val0 = TypeCaster<uint>.Cast(val);
+                return *(int*) &val0;
+            }
+
+            if (type == typeof(ulong))
+            {
+                var val0 = TypeCaster<ulong>.Cast(val);
+                return GetLongHashCode(*(long*) &val0);
+            }
+

Review comment:
       What about all these types? They was not supported also?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org